Class DataItemProvider
- Namespace
- Dynamicweb.Deployment
- Assembly
- Dynamicweb.Core.dll
Represents a provider of data items. This is the base class that all data item providers must inherit from.
public abstract class DataItemProvider : ConfigurableAddIn
- Inheritance
-
DataItemProvider
- Derived
- Inherited Members
Examples
using Dynamicweb.Extensibility.AddIns;
namespace Dynamicweb.Deployment.Examples
{
/// <summary>
/// This is an example of how to implement a custom data item provider.
/// Data item providers inherit from <see cref="ConfigurableAddIn"/> which means that you can add additional parameters for use when reading or writing data items.
/// </summary>
public class CustomDataItemProvider : DataItemProvider
{
/// <summary>
/// Gets or sets my property.
/// </summary>
[AddInParameter("MyProperty")]
public string MyProperty { get; set; }
public override DataItemReader CreateReader()
{
return new CustomDataItemReader(this);
}
public override DataItemWriter CreateWriter()
{
return new CustomDataItemWriter(this);
}
}
}
Properties
DataItemType
Gets the type of the data item.
public DataItemType DataItemType { get; }
Property Value
- DataItemType
The type of the data item.
Methods
CreateInstance(DataItemType)
Creates an instance of a data item provider for a specific data item type.
public static DataItemProvider CreateInstance(DataItemType itemType)
Parameters
itemType
DataItemTypeThe data item type.
Returns
CreateReader()
Creates the data item reader.
public abstract DataItemReader CreateReader()
Returns
- DataItemReader
An instance of DataItemReader.
CreateWriter()
Creates the data item writer.
public abstract DataItemWriter CreateWriter()
Returns
- DataItemWriter
An instance of DataItemWriter.
GetDataProviderTypes()
Gets the data provider types.
public static IEnumerable<Type> GetDataProviderTypes()
Returns
GetParametersToDictionary()
Gets the parameters as a dictionary.
public IDictionary<string, string> GetParametersToDictionary()
Returns
- IDictionary<string, string>
A dictionary of parameter keys and values
LoadParametersFromDictionary(IDictionary<string, string>)
Loads the parameters from dictionary.
public void LoadParametersFromDictionary(IDictionary<string, string> parameters)
Parameters
parameters
IDictionary<string, string>The parameters.