Class DataItemReader
- Namespace
- Dynamicweb.Deployment
- Assembly
- Dynamicweb.Deployment.dll
Represents a data item reader
- Inheritance
-
Data
Item Reader
- Implements
- Inherited Members
Examples
using System.Collections.Generic;
using System.Linq;
namespace Dynamicweb.Deployment.Examples
{
/// <summary>
/// This is an example of how to implement a custom data item reader.
/// </summary>
internal class CustomDataItemReader : DataItemReader
{
private CustomDataItemProvider customDataItemProvider;
public CustomDataItemReader(CustomDataItemProvider customDataItemProvider)
{
this.customDataItemProvider = customDataItemProvider;
}
/// <summary>
/// Reads the data items with the specified ids.
/// </summary>
/// <remarks>
/// It will be executed on both source and destination when doing a comparison.
/// </remarks>
/// <param name="ids">The ids.</param>
/// <returns>
/// A sequence of data items
/// </returns>
public override IEnumerable<DataItem> ReadItems(IEnumerable<string> ids)
{
var dataItems = new List<DataItem>();
// Check if we need to return all entries
var readAllEntries = ids.Any();
// Use additional parameters from the data item provider for looking up and filtering existing data (optional).
var myProperty = customDataItemProvider.MyProperty;
return dataItems;
}
}
}
Methods
CalculateChecksum(IDictionary<string, object>)
Calculates the checksum.
Parameters
properties
IDictionary<string, object>- The data item properties that should be included in the calculation of checksum value.
Returns
Dispose()
Dispose(bool)
Parameters
disposing
bool
ReadItemInfos()
Reads the data item infos.
Returns
- IEnumerable<Data
Item >Info - A sequence of data item infos
ReadItemInfos(IEnumerable<string>)
Reads the data item infos with the specified ids.
Parameters
ids
IEnumerable<string>- The ids.
Returns
- IEnumerable<Data
Item >Info - A sequence of data item infos
ReadItems()
Reads all the data items.
Returns
- IEnumerable<Data
Item > - A sequence of data items
ReadItems(IEnumerable<string>)
Reads the data items with the specified ids.
Parameters
ids
IEnumerable<string>- The ids.
Returns
- IEnumerable<Data
Item > - A sequence of data items