Class VennSetProcessor
Implements
Inherited Members
Namespace: LemonEdge.API.Core.Processors
Assembly: LemonEdge.API.Core.dll
Syntax
public class VennSetProcessor : IVennSetProcessor, IBaseDataSetProcessorWithDBSave, IBaseDataSetProcessor, IProcessor, IDisposable
Constructors
VennSetProcessor(IEntityUpdater, IReadOnlyCache, UserInfo, IQueryableTypeFactory, IServiceContext)
Declaration
public VennSetProcessor(IEntityUpdater updater, IReadOnlyCache cache, UserInfo user, IQueryableTypeFactory queryableTypeFactory, IServiceContext services)
Parameters
Type | Name | Description |
---|---|---|
IEntityUpdater | updater | |
IReadOnlyCache | cache | |
UserInfo | user | |
IQueryableTypeFactory | queryableTypeFactory | |
IServiceContext | services |
Properties
Cache
A local cache for performance
Declaration
public IReadOnlyCache Cache { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCache |
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<IVennSetQueryableItemFieldInfo> FieldInfos { get; }
Property Value
Type | Description |
---|---|
IEnumerable<IVennSetQueryableItemFieldInfo> |
Filters
A list of all the filter records to be applied to the vennset results
Declaration
public IEnumerable<IFilterDescriptor> Filters { get; }
Property Value
Type | Description |
---|---|
IEnumerable<IFilterDescriptor> |
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
Type | Description |
---|---|
bool |
Loaded
Flag to indicate if the processor has been fully loaded
Declaration
public bool Loaded { get; }
Property Value
Type | Description |
---|---|
bool |
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
Type | Description |
---|---|
short |
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
Type | Description |
---|---|
BusyProgressReporter |
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
Type | Description |
---|---|
bool |
Updater
A context to ensure the process can query, load and modify all LemonEdge data
Declaration
public IEntityUpdater Updater { get; }
Property Value
Type | Description |
---|---|
IEntityUpdater |
User
The current logged in user the process is running under
Declaration
public UserInfo User { get; }
Property Value
Type | Description |
---|---|
UserInfo |
VennSet
The root vennset item this processor is responsible for
Declaration
public IVennSet VennSet { get; }
Property Value
Type | Description |
---|---|
IVennSet |
VennSetQueryableItems
The list of items that are being queried by this vennset
Declaration
public IEnumerable<IVennSetQueryableItem> VennSetQueryableItems { get; }
Property Value
Type | Description |
---|---|
IEnumerable<IVennSetQueryableItem> |
Wrapper
The ISQLWrapper that backs this vennset and holds the automatically created sql
Declaration
public ISQLWrapper Wrapper { get; }
Property Value
Type | Description |
---|---|
ISQLWrapper |
Methods
AddToDataSetToProcess(IBaseEntity, EntityOperation)
If a modified item belongs in the processor (IsChangedItemPartOfDataSet(IBaseEntity)), this adds the item to the processor if it already isn't a member of it
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. |
Dispose()
Declaration
public void Dispose()
Dispose(bool)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing |
GetQueryableItem(Guid)
Returns an instance of the actual queryable item for the specified IVennSetQueryableItem
Declaration
public IQueryableItem GetQueryableItem(Guid forDataSourceQueryableItemID)
Parameters
Type | Name | Description |
---|---|---|
Guid | forDataSourceQueryableItemID | The IVennSetQueryableItem to return an instance of the actual queryable item for |
Returns
Type | Description |
---|---|
IQueryableItem | An instance of the actual queryable item for the specified IVennSetQueryableItem |
GetQueryableItemFields(Guid)
Returns all the possible field items for the specified IVennSetQueryableItem
Declaration
public IEnumerable<IQueryableFieldInfo> GetQueryableItemFields(Guid forDataSourceQueryableItemID)
Parameters
Type | Name | Description |
---|---|---|
Guid | forDataSourceQueryableItemID | The IVennSetQueryableItem to return all the possible field items for |
Returns
Type | Description |
---|---|
IEnumerable<IQueryableFieldInfo> | All the possible field items for the specified IVennSetQueryableItem |
GetQueryableItemParameters(IVennSetQueryableItem)
Declaration
public IEnumerable<IVennSetQueryableItemParam> GetQueryableItemParameters(IVennSetQueryableItem item)
Parameters
Type | Name | Description |
---|---|---|
IVennSetQueryableItem | item |
Returns
Type | Description |
---|---|
IEnumerable<IVennSetQueryableItemParam> |
GetQueryableItemParams(Guid)
Returns all the possible parameters for the specified IVennSetQueryableItem
Declaration
public IEnumerable<IQueryableParamInfo> GetQueryableItemParams(Guid forDataSourceQueryableItemID)
Parameters
Type | Name | Description |
---|---|---|
Guid | forDataSourceQueryableItemID | The IVennSetQueryableItem to return all the possible parameters for |
Returns
Type | Description |
---|---|
IEnumerable<IQueryableParamInfo> | All the possible parameters for the specified IVennSetQueryableItem |
GetTotalQueriedEntities()
Returns all the entities that are queried in this vennset and any sub-vennsets
Declaration
public IEnumerable<EntityDescriptor> GetTotalQueriedEntities()
Returns
Type | Description |
---|---|
IEnumerable<EntityDescriptor> | All the entities that are queried in this vennset and any sub-vennsets |
GetWrapperTypes(IVennSetQueryableItem)
Returns the collection of ISQLTypeWrapper that are for the column results of the specified IVennSetQueryableItemFieldInfo
Declaration
public IEnumerable<ISQLTypeWrapper> GetWrapperTypes(IVennSetQueryableItem item)
Parameters
Type | Name | Description |
---|---|---|
IVennSetQueryableItem | item | The sql type wrappers defining the columns for this queryable item |
Returns
Type | Description |
---|---|
IEnumerable<ISQLTypeWrapper> | The collection of ISQLTypeWrapper that are for the column results of the specified IVennSetQueryableItemFieldInfo |
GetWrapperTypes(SQLTypeWrapperType)
Returns the collection of ISQLTypeWrapper that are for the parameters or column results of this vennset (and thus in turn the ISQLWrapper itself)
Declaration
public IEnumerable<ISQLTypeWrapper> GetWrapperTypes(SQLTypeWrapperType type)
Parameters
Type | Name | Description |
---|---|---|
SQLTypeWrapperType | type | The type of sql type wrappers to return - either for the parameters or columns |
Returns
Type | Description |
---|---|
IEnumerable<ISQLTypeWrapper> | The collection of ISQLTypeWrapper that are for the parameters or column results of this vennset |
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 |
Load()
A thread safe implementation to load all required data for the processor
Once completed Loaded should return true.
Declaration
public Task Load()
Returns
Type | Description |
---|---|
Task | A task indicating the completion of the load operation |
OnAddFieldInfo(IVennSetQueryableItemFieldInfo)
Adds the specified queryable item field info record to this vennset
Declaration
public void OnAddFieldInfo(IVennSetQueryableItemFieldInfo item)
Parameters
Type | Name | Description |
---|---|---|
IVennSetQueryableItemFieldInfo | item | The queryable item field info to add to this vennset |
OnAddFilter(IVennSetQueryableItem, IFilterDescriptor)
Adds the specified filter descriptor to this vennset
Declaration
public void OnAddFilter(IVennSetQueryableItem forQueryableItem, IFilterDescriptor filter)
Parameters
Type | Name | Description |
---|---|---|
IVennSetQueryableItem | forQueryableItem | Adds the filter to the specified queryable item |
IFilterDescriptor | filter |
OnAddQueryableItem(IVennSetQueryableItem)
Adds the specified queryable item record to this vennset
Declaration
public Task OnAddQueryableItem(IVennSetQueryableItem item)
Parameters
Type | Name | Description |
---|---|---|
IVennSetQueryableItem | item | The queryable item to add to this vennset |
Returns
Type | Description |
---|---|
Task | A task indicating the completion of the operation |
OnAddQueryableItemParam(IVennSetQueryableItemParam)
Declaration
public void OnAddQueryableItemParam(IVennSetQueryableItemParam item)
Parameters
Type | Name | Description |
---|---|---|
IVennSetQueryableItemParam | item |
OnAddWrapperType(ISQLTypeWrapper)
Adds the specified sql wrapper type record, of either a column, parameter, or queryable item, for the vennset and thus the underlying sqlwrapper too
Declaration
public void OnAddWrapperType(ISQLTypeWrapper item)
Parameters
Type | Name | Description |
---|---|---|
ISQLTypeWrapper | item | The specified sql wrapper type record, of either a column, parameter, or queryable item, for the vennset and thus the underlying sqlwrapper too |
OnAddWrapperType(IVennSetQueryableItem, ISQLTypeWrapper)
Adds the specified sql wrapper type record, for the queryable item, indicating the result from that set to use
Declaration
public void OnAddWrapperType(IVennSetQueryableItem forQueryableItem, ISQLTypeWrapper item)
Parameters
Type | Name | Description |
---|---|---|
IVennSetQueryableItem | forQueryableItem | The queryable item to use this column from |
ISQLTypeWrapper | item | The specified sql wrapper type record, for the queryable item, indicating the result from that set to use |
OnDeleteFieldInfo(IVennSetQueryableItemFieldInfo)
Deletes the specified queryable item field info record from this vennset
Declaration
public void OnDeleteFieldInfo(IVennSetQueryableItemFieldInfo item)
Parameters
Type | Name | Description |
---|---|---|
IVennSetQueryableItemFieldInfo | item | The queryable item field info to remove from this vennset |
OnDeleteFilter(IFilterDescriptor)
Deletes the specified filter descriptor from this vennset
Declaration
public void OnDeleteFilter(IFilterDescriptor filter)
Parameters
Type | Name | Description |
---|---|---|
IFilterDescriptor | filter |
OnDeleteQueryableItem(IVennSetQueryableItem)
Deletes the specified queryable item record from this vennset
Declaration
public void OnDeleteQueryableItem(IVennSetQueryableItem item)
Parameters
Type | Name | Description |
---|---|---|
IVennSetQueryableItem | item | The queryable item to remove from this vennset |
OnDeleteQueryableItemParam(IVennSetQueryableItemParam)
Declaration
public void OnDeleteQueryableItemParam(IVennSetQueryableItemParam item)
Parameters
Type | Name | Description |
---|---|---|
IVennSetQueryableItemParam | item |
OnDeleteWrapperType(ISQLTypeWrapper)
Deletes the specified sql wrapper type record, of either a column, parameter, or queryable item, from the vennset 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 vennset |
OverrideWithLocalCache(IReadOnlyCache)
Declaration
public void OverrideWithLocalCache(IReadOnlyCache cache)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCache | cache |
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
Type | Description |
---|---|
Task |
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
Type | Description |
---|---|
Task |
Remarks
When running in a service this will be disposed of anyway, it is only relevant for when the client is directly connected to the database server.
Validate()
Declaration
public Task Validate()
Returns
Type | Description |
---|---|
Task |