Class NestedPersistFacade
Inheritance
Implements
Inherited Members
Namespace: SuperOffice.Data
Assembly: SoDataBase.dll
Syntax
public abstract class NestedPersistFacade : NestedPersist, INestedPersist
Constructors
NestedPersistFacade()
Declaration
protected NestedPersistFacade()
Properties
IsDirty
Is the object dirty?
Declaration
public override bool IsDirty { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
Methods
GetFacadingItems()
Implement this method to expose items that needs to be persisted.
Declaration
protected abstract IEnumerable<INestedPersist> GetFacadingItems()
Returns
| Type | Description |
|---|---|
| IEnumerable<INestedPersist> | Collection of items that needs to be persisted. |
OnIdUpdateAsync()
Update related objects with correct id's to make sure that relations are consistent before saving to the database.
Declaration
protected override Task OnIdUpdateAsync()
Returns
| Type | Description |
|---|---|
| Task |
Overrides
OnPreIdUpdateAsync()
Allow for "fake id's" to be forced upon related objects.
Declaration
protected override Task OnPreIdUpdateAsync()
Returns
| Type | Description |
|---|---|
| Task |
Overrides
Remarks
In order to figure out which objects taking part of the nested save operation that actually needs to be saved, this method allows for "fake id's" to be forced upon related objects. Upon receiving the "fake id", the objects receiving such an id can determine if they needs to be persisted (e.g. saved) to the database. However, the fake id's forced upon related objects must be set to correct id's in the OnIdUpdate method taking place later in the save operation.
OnPrimaryKeyRequestAsync(PKContainer)
Allow the object to add itself to a collection of requests for primary keys.
Declaration
protected override Task OnPrimaryKeyRequestAsync(PKContainer pkContainer)
Parameters
| Type | Name | Description |
|---|---|---|
| PKContainer | pkContainer | Collection of objects getting a primary key. |
Returns
| Type | Description |
|---|---|
| Task |
Overrides
Remarks
When implementing this method, add yourself to the collection if you need a new primary key.
OnPrimaryKeyUpdateAsync(PKContainer)
Update primary key.
Declaration
protected override Task OnPrimaryKeyUpdateAsync(PKContainer pkContainer)
Parameters
| Type | Name | Description |
|---|---|---|
| PKContainer | pkContainer | Collection of objects getting a primary key. |
Returns
| Type | Description |
|---|---|
| Task |
Overrides
OnSaveAsync(BatchSave)
Add the object to the collection of objects that are to be saved within the transaction.
Declaration
protected override Task OnSaveAsync(BatchSave batchSave)
Parameters
| Type | Name | Description |
|---|---|---|
| BatchSave | batchSave | An object holding all the objects that needs to be persisted. |
Returns
| Type | Description |
|---|---|
| Task |
Overrides
OnSavedAsync(bool)
Called after the save operation has completed. A boolean value is passed to notify whether or not the save operation succeeded. The complete save operation is rolled back if Save operation failed.
Declaration
protected override Task OnSavedAsync(bool bSucceeded)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | bSucceeded | True if the save operation succeeded and false if the save operation failed and rolled back. |
Returns
| Type | Description |
|---|---|
| Task |