Class DataSetProcessor
Inheritance
DataSetProcessor
Assembly: LemonEdge.API.Core.dll
Syntax
public class DataSetProcessor : IDataSetProcessor, IBaseDataSetProcessorWithDBSave, IBaseDataSetProcessor, IProcessor, IDisposable
Constructors
DataSetProcessor(IEntityUpdater, IReadOnlyCache, UserInfo, IServiceContext, IQueryableTypeFactory)
Declaration
public DataSetProcessor(IEntityUpdater updater, IReadOnlyCache cache, UserInfo user, IServiceContext services, IQueryableTypeFactory queryableTypeFactory)
Parameters
Properties
Cache
A local cache for performance
Declaration
public IReadOnlyCache Cache { get; }
Property Value
Dataset
The root dataset item this processor is responsible for
Declaration
public IDataset Dataset { get; }
Property Value
FieldInfos
The list of field info records that describe what produced a specified column
ISQLTypeWrapper record.
This links the queryable item field
GetFields(IReadOnlyCache) to the corrosponding
column holding the value result
Declaration
public IEnumerable<IDatasetQueryableItemFieldInfo> FieldInfos { get; }
Property Value
IgnoreEvents
Indicates the processor should ignore changes to any items within the processor
Normally used when the processor responds to an event and wants to prevent any other responses while it
finishes processing that change
Declaration
public bool IgnoreEvents { get; set; }
Property Value
Loaded
Flag to indicate if the processor has been fully loaded
Declaration
public bool Loaded { get; }
Property Value
Order
If we have multiple save processors working, this indicates the order in which they will be processed with relation
to each other
Declaration
public short Order { get; }
Property Value
Reporter
A reporter to provide feedback to a log, or client depending on the context the process is running under
Declaration
public BusyProgressReporter Reporter { get; set; }
Property Value
SaveProcessed
Indicates the ProcessOnDBSave has already been run. This is set by the system during save, and prevents recursive
calls.
It is also released by the system on save completion/failure
Declaration
public bool SaveProcessed { get; set; }
Property Value
Services
Declaration
public IServiceContext Services { get; }
Property Value
Updater
A context to ensure the process can query, load and modify all LemonEdge data
Declaration
public IEntityUpdater Updater { get; }
Property Value
User
The current logged in user the process is running under
Declaration
public UserInfo User { get; }
Property Value
Wrapper
The ISQLWrapper that backs this dataset and holds the automatically created sql
Declaration
public ISQLWrapper Wrapper { get; }
Property Value
Methods
AddToDataSetToProcess(IBaseEntity, EntityOperation)
Declaration
public void AddToDataSetToProcess(IBaseEntity item, EntityOperation operationType)
Parameters
Type |
Name |
Description |
IBaseEntity |
item |
The item to add to the processor
|
EntityOperation |
operationType |
The type of operation that modified the item. Useful as deleted items can often be treated
differently in a processor.
|
AllDatasetQueryableItems()
Declaration
public IEnumerable<IDatasetQueryableItem> AllDatasetQueryableItems()
Returns
BelongsToDatasetQueryableItemSet(IFilterDescriptor, IDatasetQueryableItem)
Declaration
public bool BelongsToDatasetQueryableItemSet(IFilterDescriptor desc, IDatasetQueryableItem item)
Parameters
Returns
BelongsToDatasetQueryableItemSet(ISQLTypeWrapper, IDatasetQueryableItem)
Declaration
public bool BelongsToDatasetQueryableItemSet(ISQLTypeWrapper typeWrapper, IDatasetQueryableItem item)
Parameters
Returns
Dispose()
Declaration
Dispose(bool)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type |
Name |
Description |
bool |
disposing |
|
GetColumns(IDatasetQueryableItem)
Declaration
public IEnumerable<ISQLTypeWrapper> GetColumns(IDatasetQueryableItem forRoot)
Parameters
Returns
GetDatasetQueryableItemRoots()
Declaration
public IEnumerable<IDatasetQueryableItem> GetDatasetQueryableItemRoots()
Returns
GetDatasetQueryableItems(IDatasetQueryableItem)
Declaration
public IEnumerable<IDatasetQueryableItem> GetDatasetQueryableItems(IDatasetQueryableItem item)
Parameters
Returns
GetFilters(IEnumerable<IFilterDescriptor>)
Declaration
public IEnumerable<IFilterDescriptor> GetFilters(IEnumerable<IFilterDescriptor> items)
Parameters
Returns
GetFilters(Guid?)
Declaration
public IEnumerable<IFilterDescriptor> GetFilters(Guid? datasetQueryableItemID)
Parameters
Type |
Name |
Description |
Guid? |
datasetQueryableItemID |
|
Returns
GetFirstRootQueryableItem()
Declaration
public IDatasetQueryableItem GetFirstRootQueryableItem()
Returns
GetParameters()
Declaration
public IEnumerable<ISQLTypeWrapper> GetParameters()
Returns
Declaration
public Task<IEnumerable<IQueryableItem>> GetPossibleRelatedItems(IDatasetQueryableItem toItem, IQueryableType forType)
Parameters
Returns
GetQueryableItem(Guid)
Declaration
public IQueryableItem GetQueryableItem(Guid forDataSourceQueryableItemID)
Parameters
Type |
Name |
Description |
Guid |
forDataSourceQueryableItemID |
The IDatasetQueryableItem to return an instance
of the actual queryable item for
|
Returns
GetQueryableItemFields(Guid)
Declaration
public IEnumerable<IQueryableFieldInfo> GetQueryableItemFields(Guid forDataSourceQueryableItemID)
Parameters
Returns
GetQueryableItemParams(Guid)
Declaration
public IEnumerable<IQueryableParamInfo> GetQueryableItemParams(Guid forDataSourceQueryableItemID)
Parameters
Returns
GetRootQueryableItem(IDatasetQueryableItem)
Declaration
public IDatasetQueryableItem GetRootQueryableItem(IDatasetQueryableItem item)
Parameters
Returns
GetSubEntities()
Declaration
public IEnumerable<EntityDescriptor> GetSubEntities()
Returns
GetSubQueries()
Returns all sub queries referenced directly by this dataset
Declaration
public IEnumerable<SQLWrapperInterpretor> GetSubQueries()
Returns
GetTotalQueriedEntities()
Returns all the entities that are queried in this dataset and any sub-datasets
Declaration
public IEnumerable<EntityDescriptor> GetTotalQueriedEntities()
Returns
IsChangedItemPartOfDataSet(IBaseEntity)
This function returns true if the specified modified item belongs in this processor.
Non modified items will just automatically be loaded by the processor anyway, this is more to keep track of
items as they are changed and should be added to the processor without having to reload
Declaration
public bool IsChangedItemPartOfDataSet(IBaseEntity item)
Parameters
Type |
Name |
Description |
IBaseEntity |
item |
The item to check if it belongs in this processor
|
Returns
Type |
Description |
bool |
True if the specified item belongs in this processor
|
IsFirstRootQueryableItem(IDatasetQueryableItem)
Declaration
public bool IsFirstRootQueryableItem(IDatasetQueryableItem item)
Parameters
Returns
Joins(Guid)
Declaration
public IEnumerable<IDatasetQueryableItemJoin> Joins(Guid forDataSetQueryableItemID)
Parameters
Returns
Load()
A thread safe implementation to load all required data for the processor
Once completed Loaded should return true.
Declaration
Returns
Type |
Description |
Task |
A task indicating the completion of the load operation
|
NotifyQueryableItemAdded()
Declaration
public void NotifyQueryableItemAdded()
OnAddFieldInfo(IDatasetQueryableItemFieldInfo)
Adds the specified queryable item field info record to this dataset
Declaration
public void OnAddFieldInfo(IDatasetQueryableItemFieldInfo item)
Parameters
OnAddFilter(IDatasetQueryableItem, IFilterDescriptor)
Adds the specified filter descriptor to this dataset
Declaration
public void OnAddFilter(IDatasetQueryableItem rootItem, IFilterDescriptor filter)
Parameters
OnAddJoin(IDatasetQueryableItemJoin)
Adds the specified queryable item join record to this dataset
Declaration
public void OnAddJoin(IDatasetQueryableItemJoin item)
Parameters
OnAddQueryableItem(IDatasetQueryableItem)
Adds the specified queryable item record to this dataset
Declaration
public Task<int> OnAddQueryableItem(IDatasetQueryableItem item)
Parameters
Returns
Type |
Description |
Task<int> |
A task indicating the completion of the operation
|
OnAddQueryableItem(IDatasetQueryableItem, bool)
Declaration
public Task<int?> OnAddQueryableItem(IDatasetQueryableItem item, bool addDefaultJoins)
Parameters
Returns
OnAddWrapperType(IDatasetQueryableItem, ISQLTypeWrapper)
Adds the specified sql wrapper type record, of either a column or parameter, for the dataset and thus the
underlying sqlwrapper too
Declaration
public void OnAddWrapperType(IDatasetQueryableItem rootItem, ISQLTypeWrapper item)
Parameters
OnDeleteFieldInfo(IDatasetQueryableItemFieldInfo)
Deletes the specified queryable item field info record from this dataset
Declaration
public void OnDeleteFieldInfo(IDatasetQueryableItemFieldInfo item)
Parameters
OnDeleteFilter(IFilterDescriptor)
Deletes the specified filter descriptor from this dataset
Declaration
public void OnDeleteFilter(IFilterDescriptor filter)
Parameters
OnDeleteJoin(IDatasetQueryableItemJoin)
Deletes the specified queryable item join record from this dataset
Declaration
public void OnDeleteJoin(IDatasetQueryableItemJoin item)
Parameters
OnDeleteQueryableItem(IDatasetQueryableItem)
Deletes the specified queryable item record from this dataset
Declaration
public void OnDeleteQueryableItem(IDatasetQueryableItem item)
Parameters
OnDeleteWrapperType(ISQLTypeWrapper)
Deletes the specified sql wrapper type record, of either a column or parameter, from the dataset and thus the
underlying sqlwrapper too
Declaration
public void OnDeleteWrapperType(ISQLTypeWrapper item)
Parameters
Type |
Name |
Description |
ISQLTypeWrapper |
item |
The sql type wrapper record for a column or parameter of this dataset
|
OverrideWithLocalCache(IReadOnlyCache)
Declaration
public void OverrideWithLocalCache(IReadOnlyCache cache)
Parameters
ProcessOnDBSave()
Will only run when connected to the database directly.
i.e. in the web service or in a client connected to the db service, not in a client connected to the web
service.
For the client connected to the webservice, as part of the webservices save routine it will call this.
Declaration
public Task ProcessOnDBSave()
Returns
RollbackChanges()
During process on db save, the context can be left in an inconsistent state if it fails any validation. This is
called if the transactional save failed and the context must be put back to a consistent state similar to before
ProcessOnDBSave was called.
Most processors are fine running again after a failed transaction save has been fixed by the user.
However some require work to be undone such as cancel/correct objects being created for transactions. The
cancel/correct transactions need to be removed.
Declaration
public Task RollbackChanges()
Returns
UpdateAllUnionQueryableItemLinks()
Declaration
public void UpdateAllUnionQueryableItemLinks()
UpdateColour(IDatasetQueryableItemFieldInfo)
Declaration
public void UpdateColour(IDatasetQueryableItemFieldInfo item)
Parameters
UpdateFiltersParentID(Guid, Guid, IFilterDescriptor)
Updates filters ParentID after copying the DatasetQueryableItems
Declaration
public void UpdateFiltersParentID(Guid originalItemId, Guid copiedItemId, IFilterDescriptor filter)
Parameters
Type |
Name |
Description |
Guid |
originalItemId |
Original DataSetQueryableItem's Id which is being copied
|
Guid |
copiedItemId |
Copied DatasetQueryableItem's Id
|
IFilterDescriptor |
filter |
The filter descriptor to add to this dataset
|
Validate()
Declaration
Returns
Events
OnEventOccured
Raises an event when changes to the processor occur
Declaration
public event DatasetProcessorEventHandler OnEventOccured
Event Type
Implements
Extension Methods