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()

Declaration
protected NestedPersist()

Fields

_isSaving

Declaration
protected bool _isSaving
Field Value
Type Description
Boolean

_saveOwner

Declaration
protected INestedPersist _saveOwner
Field Value
Type Description
INestedPersist

Properties

IsDeleted

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

IsDirty

Is the object dirty?

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

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
Boolean

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
Boolean

Methods

OnIdUpdate()

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

Declaration
protected virtual void OnIdUpdate()

OnPreIdUpdate()

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

Declaration
protected virtual 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
protected virtual 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
protected virtual void OnPrimaryKeyUpdate(PKContainer pkContainer)
Parameters
Type Name Description
PKContainer pkContainer

Collection of objects getting a primary key.

OnSave(BatchSave)

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

Declaration
protected virtual void OnSave(BatchSave batchSave)
Parameters
Type Name Description
BatchSave batchSave

An object holding all the objects that needs to be persisted.

OnSaved(Boolean)

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 void OnSaved(bool bSucceeded)
Parameters
Type Name Description
Boolean bSucceeded

True if the save operation succeeded and false if the save operation failed and rolled back.

Save()

Save all the contained objects to the database.

Declaration
public virtual void Save()
Remarks

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

    Explicit Interface Implementations

    INestedPersist.OnIdUpdate()

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

    Declaration
    void INestedPersist.OnIdUpdate()

    INestedPersist.OnPreIdUpdate()

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

    Declaration
    void INestedPersist.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.

    INestedPersist.OnPrimaryKeyRequest(PKContainer)

    Allow the object to add itself to a collection of requests for primary keys.

    Declaration
    void INestedPersist.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.

    INestedPersist.OnPrimaryKeyUpdate(PKContainer)

    Update primary key.

    Declaration
    void INestedPersist.OnPrimaryKeyUpdate(PKContainer pkContainer)
    Parameters
    Type Name Description
    PKContainer pkContainer

    Collection of objects getting a primary key.

    INestedPersist.OnSave(BatchSave)

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

    Declaration
    void INestedPersist.OnSave(BatchSave batchSave)
    Parameters
    Type Name Description
    BatchSave batchSave

    An object holding all the objects that needs to be persisted.

    INestedPersist.OnSaved(Boolean)

    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 INestedPersist.OnSaved(bool bSucceeded)
    Parameters
    Type Name Description
    Boolean bSucceeded

    True if the save operation succeeded and false if the save operation failed and rolled back.

    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