Show / Hide Table of Contents

Class NestedPersist

Default implementation of INestedPersist.

Inheritance
object
NestedPersist
AppointmentMatrix
EntityBase
QuoteData
NestedPersistFacade
Implements
INestedPersist
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOffice.Data
Assembly: SoDataBase.dll
Syntax
public abstract class NestedPersist : INestedPersist

Constructors

NestedPersist()

Default implementation of INestedPersist.

Declaration
protected NestedPersist()

Fields

_isSaving

Default implementation of INestedPersist.

Declaration
protected bool _isSaving
Field Value
Type Description
bool

_saveOwner

Default implementation of INestedPersist.

Declaration
protected INestedPersist _saveOwner
Field Value
Type Description
INestedPersist

Properties

IsDeleted

Gets a value indicating whether this instance is deleted.

Declaration
public abstract bool IsDeleted { get; }
Property Value
Type Description
bool

true if this instance is deleted; otherwise, false.

IsDirty

Is the object dirty?

Declaration
public abstract bool IsDirty { get; }
Property Value
Type Description
bool

IsMarkedForDelete

Gets or sets a value indicating whether this instance is marked for delete.

Declaration
public virtual bool IsMarkedForDelete { get; set; }
Property Value
Type Description
bool

true if this instance is marked for delete; otherwise, false.

IsSaving

Is the nested persist in a saving state, hence disable Sentry when reading id's

Declaration
public virtual bool IsSaving { get; }
Property Value
Type Description
bool

Methods

OnIdUpdateAsync()

Update related objects with correct id's to make sure that relations are consistent before saving to the database.

Declaration
protected virtual Task OnIdUpdateAsync()
Returns
Type Description
Task

OnPreIdUpdateAsync()

Allow for "fake id's" to be forced upon related objects.

Declaration
protected virtual Task OnPreIdUpdateAsync()
Returns
Type Description
Task
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 virtual Task OnPrimaryKeyRequestAsync(PKContainer pkContainer)
Parameters
Type Name Description
PKContainer pkContainer

Collection of objects getting a primary key.

Returns
Type Description
Task
Remarks

When implementing this method, add yourself to the collection if you need a new primary key.

OnPrimaryKeyUpdateAsync(PKContainer)

Update primary key.

Declaration
protected virtual Task OnPrimaryKeyUpdateAsync(PKContainer pkContainer)
Parameters
Type Name Description
PKContainer pkContainer

Collection of objects getting a primary key.

Returns
Type Description
Task

OnSaveAsync(BatchSave)

Add the object to the collection of objects that are to be saved within the transaction.

Declaration
protected virtual 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

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 virtual 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

SaveAsync()

Save all the contained objects to the database.

Declaration
public virtual Task SaveAsync()
Returns
Type Description
Task
Remarks
<p>

Save contained objects to the database:

    SetSaveOwner(INestedPersist)

    Force the save operation to be handled by someone else.

    Declaration
    public virtual void SetSaveOwner(INestedPersist saveOwner)
    Parameters
    Type Name Description
    INestedPersist saveOwner

    The object to handle the save operation.

    Events

    OnElementIdUpdate

    Event raised when the item receives a primary key

    Declaration
    public event OnIdUpdate OnElementIdUpdate
    Event Type
    Type Description
    OnIdUpdate

    OnElementSaved

    Event raised when the item is saved to the database.

    Declaration
    public event OnSaved OnElementSaved
    Event Type
    Type Description
    OnSaved

    Implements

    INestedPersist

    Extension Methods

    EnumUtil.MapEnums<From, To>(From)
    Converters.MapEnums<From, To>(From)
    © SuperOffice. All rights reserved.
    SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top