Click or drag to resize
UnitOfWork2 Class
UnitOfWork2 class. Can collect actions to perform on the entities/entity collections specified. Will not perform these actions until Commit(transaction) is called. A UnitOfWork is meant to make development easier. It will not prohibit the developer to persist the actions also using other methods. Adapter Specific.
Inheritance Hierarchy
SystemObject
  SD.LLBLGen.Pro.ORMSupportClassesUnitOfWork2

Namespace:  SD.LLBLGen.Pro.ORMSupportClasses
Assembly:  SD.LLBLGen.Pro.ORMSupportClasses (in SD.LLBLGen.Pro.ORMSupportClasses.dll) Version: 5.3.0.0 (5.3.0)
Syntax
[SerializableAttribute]
public class UnitOfWork2 : IUnitOfWorkCore, 
	IXmlSerializable, ISerializable

The UnitOfWork2 type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyCommitOrder
Gets / sets the Commit Order of the various blocks the unit of work groups the elements in.
Public propertyOptimizedSerialization Obsolete.
Gets / sets the OptimizedSerialization flag. Default: true. When set to false, the serialization logic will simply serialize all entities inside the unit of work. When set to true, the unit of work will first calculate the save queues, which weeds out entities which aren't changed and won't be saved anyway, so these don't have to be sent over the wire.
Top
Methods
  NameDescription
Public methodAddCallBack(Delegate, UnitOfWorkCallBackScheduleSlot, Object)
Adds the call back passed in, to the slot specified with the parameters specified.
Public methodAddCallBack(Delegate, UnitOfWorkCallBackScheduleSlot, Boolean, Object)
Adds the call back passed in, to the slot specified with the parameters specified.
Public methodAddCollectionForDelete
Adds the collection with entities for deletion.
Public methodAddCollectionForSave(IEntityCollection2)
Adds the collection with entities for saving. No recursion and no refetch are done for these entities.
Public methodAddCollectionForSave(IEntityCollection2, Boolean, Boolean)
Adds the collection with entities for saving.
Public methodAddDeleteEntitiesDirectlyCall(String, IRelationPredicateBucket)
Adds a DeleteEntitiesDirectly call to be scheduled during Commit. It is called right after the last entity has been deleted but before the post delete callbacks are called.
Public methodAddDeleteEntitiesDirectlyCall(Type, IRelationPredicateBucket)
Adds a DeleteEntitiesDirectly call to be scheduled during Commit. It is called right after the last entity has been deleted but before the post delete callbacks are called.
Public methodAddForDelete(IEntity2)
Adds the passed in entity for deletion.
Public methodAddForDelete(IEntity2, IPredicateExpression)
Adds the passed in entity for deletion.
Public methodAddForSave(IEntity2)
Adds the passed in entity for saving. No refetching will be applied.
Public methodAddForSave(IEntity2, IPredicateExpression)
Adds the passed in entity for saving. No refetching will be applied.
Public methodAddForSave(IEntity2, Boolean)
Adds the passed in entity for saving.
Public methodAddForSave(IEntity2, IPredicateExpression, Boolean)
Adds the passed in entity for saving.
Public methodAddForSave(IEntity2, IPredicateExpression, Boolean, Boolean)
Adds the passed in entity for saving.
Public methodAddUpdateEntitiesDirectlyCall
Adds an UpdateEntitiesDirectly call to be scheduled during Commit. It is called right after the last entity has been updated but before the pre delete callbacks are called.
Public methodCommit(IDataAccessAdapter)
Commits this unit of work. It will first add all entities in the added collections to the correct bins, then it will start by first inserting all new entities, then saving all updates and then performing the deletes.
Public methodCommit(IDataAccessAdapter, Boolean)
Commits this unit of work. It will first add all entities in the added collections to the correct bins, then it will start by first inserting all new entities, then saving all updates and then performing the deletes.
Public methodCommitAsync(IDataAccessAdapter)
Async variant of Commit(IDataAccessAdapter). Commits this unit of work. It will first add all entities in the added collections to the correct bins, then it will start by first inserting all new entities, then saving all updates and then performing the deletes.
Public methodCommitAsync(IDataAccessAdapter, Boolean)
Async variant of Commit(IDataAccessAdapter, Boolean). Commits this unit of work. It will first add all entities in the added collections to the correct bins, then it will start by first inserting all new entities, then saving all updates and then performing the deletes.
Public methodCommitAsync(IDataAccessAdapter, CancellationToken)
Async variant of Commit(IDataAccessAdapter). Commits this unit of work. It will first add all entities in the added collections to the correct bins, then it will start by first inserting all new entities, then saving all updates and then performing the deletes.
Public methodCommitAsync(IDataAccessAdapter, Boolean, CancellationToken)
Async variant of Commit(IDataAccessAdapter, Boolean). Commits this unit of work. It will first add all entities in the added collections to the correct bins, then it will start by first inserting all new entities, then saving all updates and then performing the deletes.
Public methodConstructSaveProcessQueues
Constructs the save process queues for insert and update actions. These queues are constructed from the entities added to this UoW for save either individually or in a collection. Call this method to determine what the sequence will be for the insert and update actions executed during Commit(). Commit() uses this method as well as well as the serialization/deserialization logic, to avoid sending large object graphs with few changes.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetCollectionElementsToDelete
Gets the UnitOfWorkCollectionElement2s with the collections which are added with AddCollectionForDelete, in a new List. To remove a collection, call RemoveCollectionFromUoW(IEntityCollection2)
Public methodGetCollectionElementsToSave
Gets the UnitOfWorkCollectionElement2s with the collections which are added with AddCollectionForSave, in a new List. To remove a collection, call RemoveCollectionFromUoW(IEntityCollection2)
Public methodGetEntityElementsToDelete
Gets the UnitOfWorkElement2s with the entities which are added with AddForDelete, in a new List. To remove an entity, call RemoveFromUoW(IEntity2)
Public methodGetEntityElementsToInsert
Gets the UnitOfWorkElement2s with the entities which are added with AddForSave and which are new, in a new List. To remove an entity, call RemoveFromUoW(IEntity2)
Public methodGetEntityElementsToUpdate
Gets the UnitOfWorkElement2s with the entities which are added with AddForSave and which are not new, in a new List. To remove an entity, call RemoveFromUoW(IEntity2)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetInsertQueue
Gets the insert queue, which is a list of ActionQueueElement(of IEntity2) objects which have been placed in the insert queue. This queue is empty unless ConstructSaveProcessQueues has been called, or Commit has been called, which calls ConstructSaveProcessQueues under the hood. If this method is called after Commit, and Commit succeeded, the entities in the queue returned are saved succesfully. Calling Reset will not clear the queues, only ConstructSaveProcessQueues or Commit will.
Public methodGetObjectData
Populates a SerializationInfo with the data needed to serialize the target object.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetUpdateQueue
Gets the update queue, which is a List of ActionQueueElements(Of IEntity2) objects which have been placed in the update queue. This queue is empty unless ConstructSaveProcessQueues has been called, or Commit has been called, which calls ConstructSaveProcessQueues under the hood. If this method is called after Commit, and Commit succeeded, the entities in the queue returned are saved succesfully. Calling Reset will not clear the queues, only ConstructSaveProcessQueues or Commit will.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodRemoveCollectionFromUoW
Removes the specified entity collection from this UnitOfWork.
Public methodRemoveFromUoW
Removes the specified entity from this UnitOfWork. If the entity is in an added collection, the entity will later on still be added.
Public methodReset
Resets the inner contents of this unit of work.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Explicit Interface Implementations
  NameDescription
Explicit interface implementationPrivate methodIXmlSerializableGetSchema
This method is reserved and should not be used. When implementing the IXmlSerializable interface, you should return null (Nothing in Visual Basic) from this method, and instead, if specifying a custom schema is required, apply the XmlSchemaProviderAttribute to the class.
Explicit interface implementationPrivate methodIXmlSerializableReadXml
Generates an object from its XML representation.
Explicit interface implementationPrivate methodIXmlSerializableWriteXml
Converts an object into its XML representation.
Explicit interface implementationPrivate methodIUnitOfWorkCoreAddCollectionForDelete
Adds the collection with entities for deletion.
Explicit interface implementationPrivate methodIUnitOfWorkCoreAddCollectionForSave(IEntityCollectionCore)
Adds the collection with entities for saving. No recursion and no refetch are done for these entities.
Explicit interface implementationPrivate methodIUnitOfWorkCoreAddCollectionForSave(IEntityCollectionCore, Boolean, Boolean)
Adds the collection with entities for saving.
Explicit interface implementationPrivate methodIUnitOfWorkCoreAddForDelete
Adds the passed in entity for deletion.
Explicit interface implementationPrivate methodIUnitOfWorkCoreAddForSave(IEntityCore)
Adds the passed in entity for saving. No refetching will be applied. Save is recursive.
Explicit interface implementationPrivate methodIUnitOfWorkCoreAddForSave(IEntityCore, Boolean)
Adds the passed in entity for saving. No refetching will be applied. Save is recursive.
Explicit interface implementationPrivate methodIUnitOfWorkCoreCommit(ITransactionController)
Commits this unit of work. It will first add all entities in the added collections to the correct bins, then it will start by first inserting all new entities, then saving all updates and then performing the deletes. This order can be controlled by the constructor of the unit of work which allows users to define a different work order.
Explicit interface implementationPrivate methodIUnitOfWorkCoreCommit(ITransactionController, Boolean)
Commits this unit of work. It will first add all entities in the added collections to the correct bins, then it will start by first inserting all new entities, then saving all updates and then performing the deletes. This order can be controlled by the constructor of the unit of work which allows users to define a different work order.
Explicit interface implementationPrivate methodIUnitOfWorkCoreCommitAsync
Async variant of Commit(ITransactionController) Commits this unit of work. It will first add all entities in the added collections to the correct bins, then it will start by first inserting all new entities, then saving all updates and then performing the deletes. This order can be controlled by the constructor of the unit of work which allows users to define a different work order.
Explicit interface implementationPrivate methodIUnitOfWorkCoreReset
Resets the inner contents of this Unit of work object
Top
See Also