Search Results for

    Show / Hide Table of Contents

    Class DataSetProcessor

    Inheritance
    object
    DataSetProcessor
    Implements
    IDataSetProcessor
    IBaseDataSetProcessorWithDBSave
    IBaseDataSetProcessor
    IProcessor
    IDisposable
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: LemonEdge.API.Core.Processors
    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
    Type Name Description
    IEntityUpdater updater
    IReadOnlyCache cache
    UserInfo user
    IServiceContext services
    IQueryableTypeFactory queryableTypeFactory

    Properties

    Cache

    A local cache for performance

    Declaration
    public IReadOnlyCache Cache { get; }
    Property Value
    Type Description
    IReadOnlyCache

    Dataset

    The root dataset item this processor is responsible for

    Declaration
    public IDataset Dataset { get; }
    Property Value
    Type Description
    IDataset

    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
    Type Description
    IEnumerable<IDatasetQueryableItemFieldInfo>

    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

    Services

    Declaration
    public IServiceContext Services { get; }
    Property Value
    Type Description
    IServiceContext

    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

    Wrapper

    The ISQLWrapper that backs this dataset 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.

    AllDatasetQueryableItems()

    Declaration
    public IEnumerable<IDatasetQueryableItem> AllDatasetQueryableItems()
    Returns
    Type Description
    IEnumerable<IDatasetQueryableItem>

    BelongsToDatasetQueryableItemSet(IFilterDescriptor, IDatasetQueryableItem)

    Declaration
    public bool BelongsToDatasetQueryableItemSet(IFilterDescriptor desc, IDatasetQueryableItem item)
    Parameters
    Type Name Description
    IFilterDescriptor desc
    IDatasetQueryableItem item
    Returns
    Type Description
    bool

    BelongsToDatasetQueryableItemSet(ISQLTypeWrapper, IDatasetQueryableItem)

    Declaration
    public bool BelongsToDatasetQueryableItemSet(ISQLTypeWrapper typeWrapper, IDatasetQueryableItem item)
    Parameters
    Type Name Description
    ISQLTypeWrapper typeWrapper
    IDatasetQueryableItem item
    Returns
    Type Description
    bool

    Dispose()

    Declaration
    public void Dispose()

    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
    Type Name Description
    IDatasetQueryableItem forRoot
    Returns
    Type Description
    IEnumerable<ISQLTypeWrapper>

    GetDatasetQueryableItemRoots()

    Declaration
    public IEnumerable<IDatasetQueryableItem> GetDatasetQueryableItemRoots()
    Returns
    Type Description
    IEnumerable<IDatasetQueryableItem>

    GetDatasetQueryableItems(IDatasetQueryableItem)

    Declaration
    public IEnumerable<IDatasetQueryableItem> GetDatasetQueryableItems(IDatasetQueryableItem item)
    Parameters
    Type Name Description
    IDatasetQueryableItem item
    Returns
    Type Description
    IEnumerable<IDatasetQueryableItem>

    GetFilters(IEnumerable<IFilterDescriptor>)

    Declaration
    public IEnumerable<IFilterDescriptor> GetFilters(IEnumerable<IFilterDescriptor> items)
    Parameters
    Type Name Description
    IEnumerable<IFilterDescriptor> items
    Returns
    Type Description
    IEnumerable<IFilterDescriptor>

    GetFilters(Guid?)

    Declaration
    public IEnumerable<IFilterDescriptor> GetFilters(Guid? datasetQueryableItemID)
    Parameters
    Type Name Description
    Guid? datasetQueryableItemID
    Returns
    Type Description
    IEnumerable<IFilterDescriptor>

    GetFirstRootQueryableItem()

    Declaration
    public IDatasetQueryableItem GetFirstRootQueryableItem()
    Returns
    Type Description
    IDatasetQueryableItem

    GetParameters()

    Declaration
    public IEnumerable<ISQLTypeWrapper> GetParameters()
    Returns
    Type Description
    IEnumerable<ISQLTypeWrapper>

    GetPossibleRelatedItems(IDatasetQueryableItem, IQueryableType)

    Declaration
    public Task<IEnumerable<IQueryableItem>> GetPossibleRelatedItems(IDatasetQueryableItem toItem, IQueryableType forType)
    Parameters
    Type Name Description
    IDatasetQueryableItem toItem
    IQueryableType forType
    Returns
    Type Description
    Task<IEnumerable<IQueryableItem>>

    GetQueryableItem(Guid)

    Returns an instance of the actual queryable item for the specified IDatasetQueryableItem

    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
    Type Description
    IQueryableItem

    An instance of the actual queryable item for the specified IDatasetQueryableItem

    GetQueryableItemFields(Guid)

    Returns all the possible field items for the specified IDatasetQueryableItem

    Declaration
    public IEnumerable<IQueryableFieldInfo> GetQueryableItemFields(Guid forDataSourceQueryableItemID)
    Parameters
    Type Name Description
    Guid forDataSourceQueryableItemID

    The IDatasetQueryableItem to return all the possible field items for

    Returns
    Type Description
    IEnumerable<IQueryableFieldInfo>

    All the possible field items for the specified IDatasetQueryableItem

    GetQueryableItemParams(Guid)

    Returns all the possible parameters for the specified IDatasetQueryableItem

    Declaration
    public IEnumerable<IQueryableParamInfo> GetQueryableItemParams(Guid forDataSourceQueryableItemID)
    Parameters
    Type Name Description
    Guid forDataSourceQueryableItemID

    The IDatasetQueryableItem to return all the possible parameters for

    Returns
    Type Description
    IEnumerable<IQueryableParamInfo>

    All the possible parameters for the specified IDatasetQueryableItem

    GetRootQueryableItem(IDatasetQueryableItem)

    Declaration
    public IDatasetQueryableItem GetRootQueryableItem(IDatasetQueryableItem item)
    Parameters
    Type Name Description
    IDatasetQueryableItem item
    Returns
    Type Description
    IDatasetQueryableItem

    GetSubEntities()

    Declaration
    public IEnumerable<EntityDescriptor> GetSubEntities()
    Returns
    Type Description
    IEnumerable<EntityDescriptor>

    GetSubQueries()

    Returns all sub queries referenced directly by this dataset

    Declaration
    public IEnumerable<SQLWrapperInterpretor> GetSubQueries()
    Returns
    Type Description
    IEnumerable<SQLWrapperInterpretor>

    GetTotalQueriedEntities()

    Returns all the entities that are queried in this dataset and any sub-datasets

    Declaration
    public IEnumerable<EntityDescriptor> GetTotalQueriedEntities()
    Returns
    Type Description
    IEnumerable<EntityDescriptor>

    All the entities that are queried in this dataset and any sub-datasets

    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
    Type Name Description
    IDatasetQueryableItem item
    Returns
    Type Description
    bool

    Joins(Guid)

    A list of all the join records (where TargetDatasetQueryableItemID equals forDataSetQueryableItemID) for the specified IDatasetQueryableItem

    Declaration
    public IEnumerable<IDatasetQueryableItemJoin> Joins(Guid forDataSetQueryableItemID)
    Parameters
    Type Name Description
    Guid forDataSetQueryableItemID

    The IDatasetQueryableItem to return all join records for

    Returns
    Type Description
    IEnumerable<IDatasetQueryableItemJoin>

    A list of all the join records (where TargetDatasetQueryableItemID equals forDataSetQueryableItemID) for the specified IDatasetQueryableItem

    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

    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
    Type Name Description
    IDatasetQueryableItemFieldInfo item

    The queryable item field info to add to this dataset

    OnAddFilter(IDatasetQueryableItem, IFilterDescriptor)

    Adds the specified filter descriptor to this dataset

    Declaration
    public void OnAddFilter(IDatasetQueryableItem rootItem, IFilterDescriptor filter)
    Parameters
    Type Name Description
    IDatasetQueryableItem rootItem
    IFilterDescriptor filter

    OnAddJoin(IDatasetQueryableItemJoin)

    Adds the specified queryable item join record to this dataset

    Declaration
    public void OnAddJoin(IDatasetQueryableItemJoin item)
    Parameters
    Type Name Description
    IDatasetQueryableItemJoin item

    The queryable item join to add to this dataset

    OnAddQueryableItem(IDatasetQueryableItem)

    Adds the specified queryable item record to this dataset

    Declaration
    public Task<int> OnAddQueryableItem(IDatasetQueryableItem item)
    Parameters
    Type Name Description
    IDatasetQueryableItem item

    The queryable item to add to this dataset

    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
    Type Name Description
    IDatasetQueryableItem item
    bool addDefaultJoins
    Returns
    Type Description
    Task<int?>

    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
    Type Name Description
    IDatasetQueryableItem rootItem
    ISQLTypeWrapper item

    The sql type wrapper record for a column or parameter of this dataset

    OnDeleteFieldInfo(IDatasetQueryableItemFieldInfo)

    Deletes the specified queryable item field info record from this dataset

    Declaration
    public void OnDeleteFieldInfo(IDatasetQueryableItemFieldInfo item)
    Parameters
    Type Name Description
    IDatasetQueryableItemFieldInfo item

    The queryable item field info to remove from this dataset

    OnDeleteFilter(IFilterDescriptor)

    Deletes the specified filter descriptor from this dataset

    Declaration
    public void OnDeleteFilter(IFilterDescriptor filter)
    Parameters
    Type Name Description
    IFilterDescriptor filter

    OnDeleteJoin(IDatasetQueryableItemJoin)

    Deletes the specified queryable item join record from this dataset

    Declaration
    public void OnDeleteJoin(IDatasetQueryableItemJoin item)
    Parameters
    Type Name Description
    IDatasetQueryableItemJoin item

    The queryable item join to remove from this dataset

    OnDeleteQueryableItem(IDatasetQueryableItem)

    Deletes the specified queryable item record from this dataset

    Declaration
    public void OnDeleteQueryableItem(IDatasetQueryableItem item)
    Parameters
    Type Name Description
    IDatasetQueryableItem item

    The queryable item to remove from this dataset

    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
    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.

    UpdateAllUnionQueryableItemLinks()

    Declaration
    public void UpdateAllUnionQueryableItemLinks()

    UpdateColour(IDatasetQueryableItemFieldInfo)

    Declaration
    public void UpdateColour(IDatasetQueryableItemFieldInfo item)
    Parameters
    Type Name Description
    IDatasetQueryableItemFieldInfo item

    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
    public Task Validate()
    Returns
    Type Description
    Task

    Events

    OnEventOccured

    Raises an event when changes to the processor occur

    Declaration
    public event DatasetProcessorEventHandler OnEventOccured
    Event Type
    Type Description
    DatasetProcessorEventHandler

    Implements

    IDataSetProcessor
    IBaseDataSetProcessorWithDBSave
    IBaseDataSetProcessor
    IProcessor
    IDisposable

    Extension Methods

    LinqExtensions.AsArray<T>(T)
    LinqExtensions.ToArrayOfOne<T>(T)
    LinqExtensions.ToListOfOne<T>(T)
    MiscExtensions.SetIfNotEqual<T, TP>(T, Expression<Func<T, TP>>, TP)
    WeakReferenceExtensions.WeakReference(object)
    SQLExtensions.ToSQLValue(object, bool)
    ReflectionExtensions.ClearEventInvocations(object, string)
    StringExtensions.ToCSVFormatString(object, Type)
    In this article
    Back to top © LemonEdge Technologies. All rights reserved.