Class UpdateTransactionTypesProcessor
Implements
Inherited Members
Namespace: LemonEdge.API.Core.FinancialServices.Processors.Transactional
Assembly: LemonEdge.API.Core.FinancialServices.dll
Syntax
[ServerTask("Upgrade Transaction Types", "9B937293-7DF8-4F7B-B231-6208FA1D6AB9", typeof(UpgradeTransactionTypesParameters))]
[StandardSystemWrapperDataSetNames(new string[] { "GetTransactions", "GetChainedTransactionAllocations", "GetAllocatedTransactions", "GetAssociatedTransactions", "FS_AllocationOfTransactions", "FS_StructureAllocationOfTransactions" })]
public class UpdateTransactionTypesProcessor : SQLWrapperUpdater, IBaseDataSetProcessorWithDBSave, IBaseDataSetProcessor, ITaskProcessor, IProcessor, IDisposable
Constructors
UpdateTransactionTypesProcessor(IQueryBuilderFactory, IEntityUpdater, IReadOnlyCache, UserInfo, IServiceContext, IQueryableTypeFactory)
Declaration
public UpdateTransactionTypesProcessor(IQueryBuilderFactory builderFactory, IEntityUpdater updater, IReadOnlyCache cache, UserInfo user, IServiceContext services, IQueryableTypeFactory queryableTypeFactory)
Parameters
| Type | Name | Description |
|---|---|---|
| IQueryBuilderFactory | builderFactory | |
| IEntityUpdater | updater | |
| IReadOnlyCache | cache | |
| UserInfo | user | |
| IServiceContext | services | |
| IQueryableTypeFactory | queryableTypeFactory |
UpdateTransactionTypesProcessor(IQueryBuilderFactory, IQueryableTypeFactory, IServiceContext)
Declaration
public UpdateTransactionTypesProcessor(IQueryBuilderFactory builderFactory, IQueryableTypeFactory queryableTypeFactory, IServiceContext services)
Parameters
| Type | Name | Description |
|---|---|---|
| IQueryBuilderFactory | builderFactory | |
| IQueryableTypeFactory | queryableTypeFactory | |
| IServiceContext | services |
Fields
TransactionAllocatedFunctionName
Declaration
public const string TransactionAllocatedFunctionName = "FS_AllocationOfTransactions"
Field Value
| Type | Description |
|---|---|
| string |
TransactionAllocationsChainedFunctionName
Declaration
public const string TransactionAllocationsChainedFunctionName = "GetChainedTransactionAllocations"
Field Value
| Type | Description |
|---|---|
| string |
TransactionStructureAllocatedFunctionName
Declaration
public const string TransactionStructureAllocatedFunctionName = "FS_StructureAllocationOfTransactions"
Field Value
| Type | Description |
|---|---|
| string |
Properties
AlwaysRunOnDBUpgrade
Declaration
public override bool AlwaysRunOnDBUpgrade { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
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 |
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 |
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. |
AddTransactionColumnType(IQuerySelectBuilder, string, string, TransactionValueType, ITransactionTypeValue, AggregateFunction)
Declaration
public static void AddTransactionColumnType(IQuerySelectBuilder sb, string typeAlias, string valueAlias, TransactionValueType type, ITransactionTypeValue value, AggregateFunction aggFunc = AggregateFunction.None)
Parameters
| Type | Name | Description |
|---|---|---|
| IQuerySelectBuilder | sb | |
| string | typeAlias | |
| string | valueAlias | |
| TransactionValueType | type | |
| ITransactionTypeValue | value | |
| AggregateFunction | aggFunc |
AddTransactionNoteColumnType(IQuerySelectBuilder, string, string, ITransactionTypeValue, AggregateFunction)
Declaration
public static void AddTransactionNoteColumnType(IQuerySelectBuilder sb, string typeAlias, string valueAlias, ITransactionTypeValue value, AggregateFunction aggFunc = AggregateFunction.None)
Parameters
| Type | Name | Description |
|---|---|---|
| IQuerySelectBuilder | sb | |
| string | typeAlias | |
| string | valueAlias | |
| ITransactionTypeValue | value | |
| AggregateFunction | aggFunc |
Dispose()
Declaration
public void Dispose()
Dispose(bool)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing |
Init(ITaskRunner, ServerTaskParameter)
Initializes the task processor with the parameters for processing the task
Declaration
public Task Init(ITaskRunner runner, ServerTaskParameter ProcessTaskParameter)
Parameters
| Type | Name | Description |
|---|---|---|
| ITaskRunner | runner | The context within which the task is being processed |
| ServerTaskParameter | ProcessTaskParameter | The parameter for running this task |
Returns
| Type | Description |
|---|---|
| Task | A task indicating the completion of the operationn |
InitMaxTransactionPropertyNumber()
Declaration
public static void InitMaxTransactionPropertyNumber()
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 |
LoadInternal()
Declaration
public Task LoadInternal()
Returns
| Type | Description |
|---|---|
| Task |
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 |
ProcessTask(CancellationToken)
A function that implements the process for this task using the parameters provided during Init(ITaskRunner, ServerTaskParameter)
Declaration
public Task<object> ProcessTask(CancellationToken cancel)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancel | A cancellation token for cancelling any long running task |
Returns
| Type | Description |
|---|---|
| Task<object> | An optional object detailing the result which can be converted using ITaskResultHandler into a ServerTaskResult, or is a ServerTaskResult itself |
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.
UpgradeWrapper()
The custom function that is automatically called on every system database upgrade.
This can create and update a ISQLWrapper as required.
It is also capable of running any custom code during upgrades, not just upgrading sql wrapper.Declaration
public override Task UpgradeWrapper()
Returns
| Type | Description |
|---|---|
| Task |
Overrides
Validate()
Declaration
public Task Validate()
Returns
| Type | Description |
|---|---|
| Task |