Interface IDataService
This service caches IData objects and provides access to them. Data can be added to or removed from it as simple IData objects or as IDataProvider objects. A Type is passed as an argument or generic parameter to allow for implementations to manage their cache with it.
Inherited Members
Namespace: IdleKit.Core
Assembly: cs.temp.dll.dll
Syntax
public interface IDataService : IService, IInjectable
Methods
AddData(IData)
Add one IData object.
Declaration
void AddData(IData data)
Parameters
Type | Name | Description |
---|---|---|
IData | data | The IData object to add. |
AddData(IDataProvider, Action<List<IData>>)
Add one or more IData objects via IDataProvider and broadcast a callback when the data has been added.
Declaration
void AddData(IDataProvider dataProvider, Action<List<IData>> onComplete)
Parameters
Type | Name | Description |
---|---|---|
IDataProvider | dataProvider | The IDataProvider to get the data from. |
Action<List<IData>> | onComplete | Broadcast when the data has been added. |
AddData(IEnumerable<IData>)
Add one or more IData objects.
Declaration
void AddData(IEnumerable<IData> datas)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IData> | datas | One or more IData objects to add. |
GetAllData(Type)
Returns all IData objects under a specific Type.
Declaration
List<IData> GetAllData(Type dataType)
Parameters
Type | Name | Description |
---|---|---|
Type | dataType | The Type of IData objects to get. |
Returns
Type | Description |
---|---|
List<IData> |
GetAllData(Type, IEnumerable<String>)
Declaration
List<IData> GetAllData(Type dataType, IEnumerable<string> ids)
Parameters
Type | Name | Description |
---|---|---|
Type | dataType | The Type of IData objects to get. |
IEnumerable<String> | ids | The ids to retrieve data for. |
Returns
Type | Description |
---|---|
List<IData> |
GetAllData(Type, Func<IData, Boolean>)
Returns all IData objects under a specific Type that meets the predicate criteria.
Declaration
List<IData> GetAllData(Type dataType, Func<IData, bool> predicate)
Parameters
Type | Name | Description |
---|---|---|
Type | dataType | The Type of IData objects to get. |
Func<IData, Boolean> | predicate | The criteria that must be met by the IData objects. |
Returns
Type | Description |
---|---|
List<IData> |
GetAllData<TData>()
Returns all IData objects under a specific Type.
Declaration
List<TData> GetAllData<TData>()
where TData : class, IData
Returns
Type | Description |
---|---|
List<TData> |
Type Parameters
Name | Description |
---|---|
TData | The Type of IData objects to get. |
GetAllData<TData>(IEnumerable<String>)
Declaration
List<TData> GetAllData<TData>(IEnumerable<string> ids)
where TData : class, IData
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<String> | ids |
Returns
Type | Description |
---|---|
List<TData> |
Type Parameters
Name | Description |
---|---|
TData | The Type of IData objects to get. |
GetAllData<TData>(Func<TData, Boolean>)
Returns all IData objects under a specific Type that meets the predicate criteria.
Declaration
List<TData> GetAllData<TData>(Func<TData, bool> predicate)
where TData : class, IData
Parameters
Type | Name | Description |
---|---|---|
Func<TData, Boolean> | predicate | The criteria that must be met by the IData objects. |
Returns
Type | Description |
---|---|
List<TData> |
Type Parameters
Name | Description |
---|---|
TData | The Type of IData objects to get. |
GetData(Type)
Returns a single IData object by Type.
Declaration
IData GetData(Type dataType)
Parameters
Type | Name | Description |
---|---|---|
Type | dataType | The Type of IData object to get. |
Returns
Type | Description |
---|---|
IData |
GetData(Type, Func<IData, Boolean>)
Returns a single IData object by Type that meets the predicate criteria.
Declaration
IData GetData(Type dataType, Func<IData, bool> predicate)
Parameters
Type | Name | Description |
---|---|---|
Type | dataType | The Type of IData object to get. |
Func<IData, Boolean> | predicate | The criteria that must be met by the IData object. |
Returns
Type | Description |
---|---|
IData |
GetData(Type, String)
Declaration
IData GetData(Type dataType, string id)
Parameters
Type | Name | Description |
---|---|---|
Type | dataType | The Type of IData object to get. |
String | id | The Id associated with the object to get. |
Returns
Type | Description |
---|---|
IData |
GetData<TData>()
Returns a single IData object by Type.
Declaration
TData GetData<TData>()
where TData : class, IData
Returns
Type | Description |
---|---|
TData |
Type Parameters
Name | Description |
---|---|
TData | The Type of IData object to get. |
GetData<TData>(Func<TData, Boolean>)
Returns a single IData object by Type that meets the predicate criteria.
Declaration
TData GetData<TData>(Func<TData, bool> predicate)
where TData : class, IData
Parameters
Type | Name | Description |
---|---|---|
Func<TData, Boolean> | predicate | The criteria that must be met by the IData object. |
Returns
Type | Description |
---|---|
TData |
Type Parameters
Name | Description |
---|---|
TData | The Type of IData object to get. |
GetData<TData>(String)
Declaration
TData GetData<TData>(string id)
where TData : class, IData
Parameters
Type | Name | Description |
---|---|---|
String | id | The Id associated with the object to get. |
Returns
Type | Description |
---|---|
TData |
Type Parameters
Name | Description |
---|---|
TData | The Type of IData object to get. |
RemoveAllData()
Remove all IData objects.
Declaration
void RemoveAllData()
RemoveAllData(Type)
Remove all IData objects keyed by a specific Type.
Declaration
void RemoveAllData(Type dataType)
Parameters
Type | Name | Description |
---|---|---|
Type | dataType | The Type to remove the objects from. |
RemoveAllData<TData>()
Remove all IData objects keyed by a specific Type.
Declaration
void RemoveAllData<TData>()
where TData : class, IData
Type Parameters
Name | Description |
---|---|
TData | The Type to remove the objects from. |
RemoveData(IData)
Remove one IData object.
Declaration
void RemoveData(IData data)
Parameters
Type | Name | Description |
---|---|---|
IData | data | The IData object to remove. |
RemoveData(IDataProvider, Action)
Remove one or more IData objects via IDataProvider and broadcast a callback when the data has been removed.
Declaration
void RemoveData(IDataProvider dataProvider, Action onComplete)
Parameters
Type | Name | Description |
---|---|---|
IDataProvider | dataProvider | The IDataProvider to get the data from. |
Action | onComplete | Broadcast when the data has been removed. |
RemoveData(IEnumerable<IData>)
Remove one or more IData objects.
Declaration
void RemoveData(IEnumerable<IData> datas)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IData> | datas | One or more IData objects to remove. |