Class EntityBase
Summary description for EntityBase.
Inheritance
Inherited Members
Namespace: SuperOffice.CRM.Entities
Assembly: SoDataBase.dll
Syntax
public abstract class EntityBase : NestedPersist, INestedPersist, ITableRowLoadHandler
Constructors
EntityBase()
Default constructor.
Declaration
protected EntityBase()
Fields
_onGetRelatedObjects
Summary description for EntityBase.
Declaration
protected GetRelatedObjects _onGetRelatedObjects
Field Value
| Type | Description |
|---|---|
| GetRelatedObjects |
Properties
IsDirty
Check if any of the related objects are dirty.
Declaration
public override bool IsDirty { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
IsNew
Is the row new, e.g. not been inserted to the database?
Declaration
public abstract bool IsNew { get; }
Property Value
| Type | Description |
|---|---|
| bool |
MainRow
Get the main row for the entity.
Declaration
protected abstract TableRowBase MainRow { get; }
Property Value
| Type | Description |
|---|---|
| TableRowBase |
Methods
DeleteAsync()
Summary description for EntityBase.
Declaration
public abstract Task DeleteAsync()
Returns
| Type | Description |
|---|---|
| Task |
ForceEntityUpdate()
This method is called when only related objects are changed in order for the entity to force the Updated and UpdatedAssociate to be modified on the entity.
Declaration
protected abstract void ForceEntityUpdate()
GetAdditionalRelatedNestedPersistAsync(List<INestedPersist>, bool, CancellationToken)
Hand-implemented partial class code should override this method to add to the list of related nestedpersist objects
Declaration
protected virtual Task GetAdditionalRelatedNestedPersistAsync(List<INestedPersist> relatedObjects, bool lacyFetchIfNeeded, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| List<INestedPersist> | relatedObjects | |
| bool | lacyFetchIfNeeded | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
GetAdditionalRelatedNestedPersistViaBaseClassAsync(List<INestedPersist>, bool, CancellationToken)
Summary description for EntityBase.
Declaration
protected Task GetAdditionalRelatedNestedPersistViaBaseClassAsync(List<INestedPersist> relatedObjects, bool lacyFetchIfNeeded, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| List<INestedPersist> | relatedObjects | |
| bool | lacyFetchIfNeeded | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
GetRelatedNestedPersistAsync(List<INestedPersist>, bool, CancellationToken)
Generated code should override this method to return its list of related nestedpersist objects
Declaration
protected abstract Task GetRelatedNestedPersistAsync(List<INestedPersist> relatedObjects, bool lacyFetchIfNeeded, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| List<INestedPersist> | relatedObjects | |
| bool | lacyFetchIfNeeded | Lacy fetch objects that is not allready loaded if needed |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
OnIdUpdateAsync()
Summary description for EntityBase.
Declaration
protected override Task OnIdUpdateAsync()
Returns
| Type | Description |
|---|---|
| Task |
Overrides
OnIdUpdateImplementation()
Summary description for EntityBase.
Declaration
protected virtual void OnIdUpdateImplementation()
OnPreIdUpdateAsync()
Summary description for EntityBase.
Declaration
protected override Task OnPreIdUpdateAsync()
Returns
| Type | Description |
|---|---|
| Task |
Overrides
OnPreIdUpdateImplementationAsync()
Summary description for EntityBase.
Declaration
protected virtual Task OnPreIdUpdateImplementationAsync()
Returns
| Type | Description |
|---|---|
| Task |
OnPrimaryKeyRequestAsync(PKContainer)
Summary description for EntityBase.
Declaration
protected override Task OnPrimaryKeyRequestAsync(PKContainer pkContainer)
Parameters
| Type | Name | Description |
|---|---|---|
| PKContainer | pkContainer |
Returns
| Type | Description |
|---|---|
| Task |
Overrides
OnPrimaryKeyUpdateAsync(PKContainer)
Summary description for EntityBase.
Declaration
protected override Task OnPrimaryKeyUpdateAsync(PKContainer pkContainer)
Parameters
| Type | Name | Description |
|---|---|---|
| PKContainer | pkContainer |
Returns
| Type | Description |
|---|---|
| Task |
Overrides
OnRowLoad(SoDataReader, TableRowBase)
Summary description for EntityBase.
Declaration
protected abstract void OnRowLoad(SoDataReader reader, TableRowBase row)
Parameters
| Type | Name | Description |
|---|---|---|
| SoDataReader | reader | |
| TableRowBase | row |
OnRowLoaded()
Summary description for EntityBase.
Declaration
protected abstract void OnRowLoaded()
OnSaveAsync(BatchSave)
Summary description for EntityBase.
Declaration
protected override Task OnSaveAsync(BatchSave batchSave)
Parameters
| Type | Name | Description |
|---|---|---|
| BatchSave | batchSave |
Returns
| Type | Description |
|---|---|
| Task |
Overrides
OnSavedAsync(bool)
Summary description for EntityBase.
Declaration
protected override Task OnSavedAsync(bool bSucceeded)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | bSucceeded |
Returns
| Type | Description |
|---|---|
| Task |
Overrides
SetMarkedForDeleteOnRelatedObjects(bool)
Call this method to set the marked for delete on related objects.
Implement this method in implementation of enteties to set marked for delete on related objects
Declaration
protected virtual void SetMarkedForDeleteOnRelatedObjects(bool isMarkedForDelete)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | isMarkedForDelete | True if the objects are to be removed from the database the next time it is saved. |
UpdateSentryRelatedTableInfoInstance<MainTableInfoType>(SentryCollection, TableInfo)
Update a TableInfo object in all sentries in the entity, with a new instance of the same kind of table
Declaration
protected void UpdateSentryRelatedTableInfoInstance<MainTableInfoType>(SentryCollection sentries, TableInfo newInstance) where MainTableInfoType : TableInfo
Parameters
| Type | Name | Description |
|---|---|---|
| SentryCollection | sentries | |
| TableInfo | newInstance |
Type Parameters
| Name | Description |
|---|---|
| MainTableInfoType |
Remarks
This method should be called only when NEW, DEPENDENT ROW objects are being created
by a multi-row-type entity. It updates a TableInfo instance in the Sentry's SentryQueryInfo
class (the one that defines what tables the sentry should calculate rights for),
with another instance of the same type.
This has to be done so that the TableInfo in the newly created and attached Row object
matches the TableInfo in the Sentry, otherwise the Sentry will not provide any field
rights.
Calling this method in a context where a query or query results are being analyzed should be avoided,
as it only looks at the types involved and might mix up the tableinfo's from multiple
aliases of the same table in a single query.
ValidateAsync(CancellationToken)
Check the entity and related objects for consistency and required fields, and return fields and error messages.
Declaration
public abstract Task<Dictionary<string, string>> ValidateAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Dictionary<string, string>> | Field names and error messages |
Events
OnGetRelatedObjects
Event raised when related objects are being collected for saving.
Declaration
public event GetRelatedObjects OnGetRelatedObjects
Event Type
| Type | Description |
|---|---|
| GetRelatedObjects |