Method LoadDataTypeFromSource
LoadDataTypeFromSource(String, DistributedDataType)
Responsible for loading the list from the data source. name is passed as parameter.
Declaration
ProviderDataTypeItem<IEnumerable> LoadDataTypeFromSource(string key, DistributedDataType dataType)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | key used to reference object |
Alachisoft.NCache.Runtime.Caching.DistributedDataType | dataType | Type of collection. |
Returns
Type | Description |
---|---|
ProviderDataTypeItem<System.Collections.IEnumerable> |
Examples
Example performs operation to load specified data type from data source.
public ProviderDataTypeItem<IEnumerable> LoadDataTypeFromSource(string key, DistributedDataType dataType)
{
IEnumerable value = null;
ProviderDataTypeItem<IEnumerable> dataTypeItem = null;
switch (dataType)
{
case DistributedDataType.List:
value = new List<object>()
{
LoadFromDataSource(key)
};
dataTypeItem = new ProviderDataTypeItem<IEnumerable>(value);
break;
case DistributedDataType.Dictionary:
value = new Dictionary<string, object>()
{
{ key , LoadFromDataSource(key) }
};
dataTypeItem = new ProviderDataTypeItem<IEnumerable>(value);
break;
case DistributedDataType.Counter:
dataTypeItem = new ProviderDataTypeItem<IEnumerable>(1000);
break;
}
return dataTypeItem;
}
private object LoadFromDataSource(string key)
{
// Load item from your data source and return retrieved Object
return _source.LoadObject(key);
}