Interface INestedPersist
Interface to be implemented by objects that are to take place in a nested persist (INSERT/UPDATE to the database).
Namespace: SuperOffice.Data
Assembly: SoDataBase.dll
Syntax
public interface INestedPersist
Remarks
This interface support rather complex save operations. Through a 6-step process a set of related objects can take part of a save operation. All objects taking part of the nested save process should implement this interface.
In addition to exposing the 6-step save process, this interface also expose a method for the save process itself, and a property to check if the object is dirty (in need of an SQL UPDATE).
Properties
IsDeleted
Gets a value indicating whether this instance is deleted.
Declaration
bool IsDeleted { get; }
Property Value
Type | Description |
---|---|
bool |
|
Remarks
This interface support rather complex save operations. Through a 6-step process a set of related objects can take part of a save operation. All objects taking part of the nested save process should implement this interface.
In addition to exposing the 6-step save process, this interface also expose a method for the save process itself, and a property to check if the object is dirty (in need of an SQL UPDATE).
IsDirty
Is the object dirty?
Declaration
bool IsDirty { get; }
Property Value
Type | Description |
---|---|
bool |
|
Remarks
This interface support rather complex save operations. Through a 6-step process a set of related objects can take part of a save operation. All objects taking part of the nested save process should implement this interface.
In addition to exposing the 6-step save process, this interface also expose a method for the save process itself, and a property to check if the object is dirty (in need of an SQL UPDATE).
IsMarkedForDelete
Gets or sets a value indicating whether this instance is marked for delete.
Declaration
bool IsMarkedForDelete { get; set; }
Property Value
Type | Description |
---|---|
bool |
|
Remarks
This interface support rather complex save operations. Through a 6-step process a set of related objects can take part of a save operation. All objects taking part of the nested save process should implement this interface.
In addition to exposing the 6-step save process, this interface also expose a method for the save process itself, and a property to check if the object is dirty (in need of an SQL UPDATE).
IsSaving
Is the nested persist in a saving state, hence disable Sentry when reading id's
Declaration
bool IsSaving { get; }
Property Value
Type | Description |
---|---|
bool |
|
Remarks
This interface support rather complex save operations. Through a 6-step process a set of related objects can take part of a save operation. All objects taking part of the nested save process should implement this interface.
In addition to exposing the 6-step save process, this interface also expose a method for the save process itself, and a property to check if the object is dirty (in need of an SQL UPDATE).
Methods
OnIdUpdate()
Update related objects with correct id's to make sure that relations are consistent before saving to the database.
Declaration
void OnIdUpdate()
Remarks
This interface support rather complex save operations. Through a 6-step process a set of related objects can take part of a save operation. All objects taking part of the nested save process should implement this interface.
In addition to exposing the 6-step save process, this interface also expose a method for the save process itself, and a property to check if the object is dirty (in need of an SQL UPDATE).
OnPreIdUpdate()
Allow for "fake id's" to be forced upon related objects.
Declaration
void OnPreIdUpdate()
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.
OnPrimaryKeyRequest(PKContainer)
Allow the object to add itself to a collection of requests for primary keys.
Declaration
void OnPrimaryKeyRequest(PKContainer pkContainer)
Parameters
Type | Name | Description |
---|---|---|
PKContainer | pkContainer | Collection of objects getting a primary key. |
Remarks
When implementing this method, add yourself to the collection if you need a new primary key.
OnPrimaryKeyUpdate(PKContainer)
Update primary key.
Declaration
void OnPrimaryKeyUpdate(PKContainer pkContainer)
Parameters
Type | Name | Description |
---|---|---|
PKContainer | pkContainer | Collection of objects getting a primary key. |
Remarks
This interface support rather complex save operations. Through a 6-step process a set of related objects can take part of a save operation. All objects taking part of the nested save process should implement this interface.
In addition to exposing the 6-step save process, this interface also expose a method for the save process itself, and a property to check if the object is dirty (in need of an SQL UPDATE).
OnSave(BatchSave)
Add the object to the collection of objects that are to be saved within the transaction.
Declaration
void OnSave(BatchSave batchSave)
Parameters
Type | Name | Description |
---|---|---|
BatchSave | batchSave | An object holding all the objects that needs to be persisted. |
Remarks
This interface support rather complex save operations. Through a 6-step process a set of related objects can take part of a save operation. All objects taking part of the nested save process should implement this interface.
In addition to exposing the 6-step save process, this interface also expose a method for the save process itself, and a property to check if the object is dirty (in need of an SQL UPDATE).
OnSaved(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
void OnSaved(bool bSucceeded)
Parameters
Type | Name | Description |
---|---|---|
bool | bSucceeded | True if the save operation succeeded and false if the save operation failed and rolled back. |
Remarks
This interface support rather complex save operations. Through a 6-step process a set of related objects can take part of a save operation. All objects taking part of the nested save process should implement this interface.
In addition to exposing the 6-step save process, this interface also expose a method for the save process itself, and a property to check if the object is dirty (in need of an SQL UPDATE).
Save()
Save all the contained objects to the database.
Declaration
void Save()
Remarks
<p>
Save contained objects to the database:
SetSaveOwner(INestedPersist)
Force the save operation to be handled by someone else.
Declaration
void SetSaveOwner(INestedPersist saveOwner)
Parameters
Type | Name | Description |
---|---|---|
INestedPersist | saveOwner | The object to handle the save operation. |
Remarks
This interface support rather complex save operations. Through a 6-step process a set of related objects can take part of a save operation. All objects taking part of the nested save process should implement this interface.
In addition to exposing the 6-step save process, this interface also expose a method for the save process itself, and a property to check if the object is dirty (in need of an SQL UPDATE).
Events
OnElementIdUpdate
Interface to be implemented by objects that are to take place in a nested persist (INSERT/UPDATE to the database).
Declaration
event OnIdUpdate OnElementIdUpdate
Event Type
Type | Description |
---|---|
OnIdUpdate |
Remarks
This interface support rather complex save operations. Through a 6-step process a set of related objects can take part of a save operation. All objects taking part of the nested save process should implement this interface.
In addition to exposing the 6-step save process, this interface also expose a method for the save process itself, and a property to check if the object is dirty (in need of an SQL UPDATE).