Class Context
Assembly: LemonEdge.Database.Connector.dll
Syntax
public abstract class Context : IDisposable, IAsyncDisposable
Constructors
Context(IDataAccessor, IApplicationDbContextFactory, IDatabaseCacheFactory, IDatabaseConnectorServiceContext)
Declaration
protected Context(IDataAccessor accessor, IApplicationDbContextFactory dbContextFactory, IDatabaseCacheFactory cacheFactory, IDatabaseConnectorServiceContext services)
Parameters
Fields
DatabaseCacheFactory
Declaration
protected readonly IDatabaseCacheFactory DatabaseCacheFactory
Field Value
_deletesModified
Declaration
protected Dictionary<(Guid, Type), IBaseEntity> _deletesModified
Field Value
_insertsModified
Declaration
protected List<IBaseEntity> _insertsModified
Field Value
_updatesModified
Declaration
protected List<IBaseEntity> _updatesModified
Field Value
Properties
Accessor
Declaration
public IDataAccessor Accessor { get; }
Property Value
Cache
Declaration
public virtual IReadOnlyCache Cache { get; set; }
Property Value
CanvasID
Declaration
public Guid? CanvasID { get; set; }
Property Value
CommandTimeout
Declaration
public int CommandTimeout { get; }
Property Value
CommitedDateTime
Declaration
protected DateTimeOffset? CommitedDateTime { get; }
Property Value
Connection
Declaration
public IDbConnection Connection { get; }
Property Value
HasChanges
Declaration
public virtual bool HasChanges { get; }
Property Value
IsBusy
Declaration
protected virtual bool IsBusy { get; }
Property Value
IsDisposed
Declaration
public bool IsDisposed { get; }
Property Value
PromotingItemsFromCanvas
Declaration
protected bool PromotingItemsFromCanvas { get; set; }
Property Value
SafeID
Declaration
public Guid? SafeID { get; set; }
Property Value
Services
Declaration
public IDatabaseConnectorServiceContext Services { get; }
Property Value
Transaction
Declaration
public IDbTransaction Transaction { get; }
Property Value
User
Declaration
public UserInfo User { get; }
Property Value
Methods
AddCustomActionToSaveComplete(Func<IEntityUpdater, Task>)
Declaration
public void AddCustomActionToSaveComplete(Func<IEntityUpdater, Task> saveCompleteCallback)
Parameters
AddCustomSQLToEnd(string)
Declaration
public void AddCustomSQLToEnd(string sql)
Parameters
Type |
Name |
Description |
string |
sql |
|
AddCustomSQLToStart(string)
Declaration
public void AddCustomSQLToStart(string sql)
Parameters
Type |
Name |
Description |
string |
sql |
|
AddSaveDateTimeStampHandler(Action<DateTimeOffset>)
Declaration
public void AddSaveDateTimeStampHandler(Action<DateTimeOffset> commitDateTimeStampHandler)
Parameters
AddToSaveDeleteOfItem(IBaseEntity)
Declaration
public void AddToSaveDeleteOfItem(IBaseEntity item)
Parameters
AddToSaveInsertOfItem(IBaseEntity)
Declaration
public void AddToSaveInsertOfItem(IBaseEntity item)
Parameters
AddToSaveUpdateOfItem(IBaseEntity)
Declaration
public void AddToSaveUpdateOfItem(IBaseEntity item)
Parameters
BypassItemValidation(IBaseEntity)
Indicates this item should be ignored in validations
Typically used by base item where the validation is already performed by the inheriting object
Declaration
public void BypassItemValidation(IBaseEntity item)
Parameters
Type |
Name |
Description |
IBaseEntity |
item |
The item to skip validations of
|
ClearChanges()
Declaration
public virtual void ClearChanges()
Dispose()
Declaration
Dispose(bool)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type |
Name |
Description |
bool |
disposing |
|
DisposeAsync()
Declaration
public ValueTask DisposeAsync()
Returns
DisposeAsyncCore()
Declaration
protected virtual ValueTask DisposeAsyncCore()
Returns
GetCanvas()
Declaration
public ICanvas GetCanvas()
Returns
InitUser(UserInfo)
Declaration
protected void InitUser(UserInfo user)
Parameters
InternalClearOnFail()
Declaration
protected virtual void InternalClearOnFail()
IsItemAlreadyInDelete(IBaseEntity)
Declaration
public bool IsItemAlreadyInDelete(IBaseEntity item)
Parameters
Returns
IsSameTypeForDatabaseTables(IBaseEntity, IBaseEntity)
Declaration
protected virtual bool IsSameTypeForDatabaseTables(IBaseEntity item, IBaseEntity other)
Parameters
Returns
OnSaveComplete()
Declaration
public virtual Task OnSaveComplete()
Returns
PerformCustomInitializations()
Declaration
protected virtual void PerformCustomInitializations()
PerformValidations()
Declaration
protected virtual Task PerformValidations()
Returns
SetTimeout(int?)
Declaration
public void SetTimeout(int? seconds)
Parameters
Type |
Name |
Description |
int? |
seconds |
|
UseCanvas(Guid)
Declaration
public abstract IEntityRetriever UseCanvas(Guid canvasId)
Parameters
Type |
Name |
Description |
Guid |
canvasId |
|
Returns
UseTransaction(DbTransaction)
Declaration
public void UseTransaction(DbTransaction transaction)
Parameters
Implements
Extension Methods