Skip to end of metadata
Go to start of metadata

Represents an entity container, used to store and linked and synchronized entity relationship models.

Definition

public class EntityContainer : IEntityContainer

Summary

The following table summarizes the members exposed in this class.

Public Constructors

EntityContainer Constructor() Initializes a new instance of the EntityContainer class.

Public Properties

EnableSynchronization Gets or sets a value indicating whether synchronization feature is enabled.
Entities Gets the collection of entities.

Fields

Version Gets or sets the EntityContainer version.

Public Methods

AddEntity(IEntity) Adds the entity into the container.
AddEntity(IEntity, EntityConflictResolution) Adds the entity into the container.
AttachEntities(IEnumerable) Attaches the collection entities into the container.
AttachEntities(IEnumerable, EntityConflictResolution) Attaches the collection entities into the container.
AttachEntities<TEntity>(IEnumerable, EntityConflictResolution) Attaches the collection entities into the container.
AttachEntitiesAsync(IEnumerable) Attaches the collection entities into the container asynchronously.
AttachEntitiesAsync(IEnumerable, EntityConflictResolution) Attaches the collection entities into the container asynchronously.
AttachEntitiesAsync<TEntity>(IEnumerable, EntityConflictResolution) Attaches the collection entities into the container asynchronously
AttachEntity(IEntity) Attaches the entity into the container.
AttachEntity(IEntity, EntityConflictResolution) Attaches the entity into the container.
Clear<T>() Clear container for specific entity.
Clear(Type) Clear container for specific entity.
FinalizeSaveChanges(IList<IEntity>, IList<KeyMapping>) Finalizes the save changes process.
FinalizeSaveChanges(IList<IEntity>, IList<KeyMapping>, bool) Finalizes the save changes process.
FinalizeSaveChanges(IList<KeyMapping>) Finalizes the save changes process
FinalizeSaveChanges(IList<KeyMapping>, bool) Finalizes the save changes process
FindEntities(FindEntityState) Finds the entities with the specified state.
FindEntities<T>(FindEntityState) Finds the entities of the specified type and state.
FindEntity<T>(IEntity) Finds the entity in the container given the type and the entity info.
FindEntity(Type, IEntity) Finds the entity in the container given the type and the entity info.
GetContainer<T>() Gets the container for the specified entity type.
GetContainer(Type) Gets the container for the specified entity type.
GetEntities<T>() Gets the entities of the specified type.
GetEntity<T>(object, Object[]) Gets the entity with the specified type given its primary key.
GetTempIdentity() Gets the temporary identity.
PrepareSavedEntities() Return collection of entities model that going to be saved. These entities models are simplified models without references to its related model. Which will be used as DTO for WebAPI services.
PrepareSavedEntity(IEntity) Return an entity model that going to be saved. This entity model is a simplified model without references to its related model. Which will be used as DTO for WebAPI services.
RejectChanges() Rejects all changes that currently tracked.
RejectChanges(IEnumerable) Rejects the changes from the specified entities.
RemoveEntity(IEntity) Removes the entity from the container.
ResetTempIdentity() Resets the temporary identity counter.
SynchronizeEntities(IEnumerable, DateTime) Synchronizes the entities.
SynchronizeEntities(IEnumerable, DateTime, EntityConflictResolution) Synchronizes the entities.
SynchronizeEntities<T>(IEnumerable, DateTime, EntityConflictResolution) Synchronizes the entities.

Public Constructors

public EntityContainer()

Initializes a new instance of the EntityContainer class.

Public Properties

public bool EnableSynchronization { get; set; }

Gets or sets a value indicating whether synchronization feature is enabled.

public Dictionary<Type, Dictionary<string, IEntity>> Entities { get; }

Gets the collection of entities.

Fields

public static Version Version

Gets or sets the EntityContainer version.

Remarks

The version determines the logic to manage the entity relationship within the container. The older version is kept for compatibility purposes.

Public Methods

public void AddEntity(IEntity entity)

Adds the entity into the container.

Parameters

entity The entity.

public void AddEntity(IEntity entity, EntityConflictResolution conflictResolution)

Adds the entity into the container.

Parameters

entity The entity.
conflictResolution The conflict resolution.

public IList AttachEntities(IEnumerable entities)

Attaches the collection entities into the container.

Parameters

entities The entities.

Return Types

Attached entities.

public IList AttachEntities(IEnumerable entities, EntityConflictResolution conflictResolution)

Attaches the collection entities into the container.

Parameters

entities The entities.
conflictResolution The conflict resolution.

Return Types

Attached entities.

public IList<TEntity> AttachEntities<TEntity>(IEnumerable entities, EntityConflictResolution conflictResolution)

Attaches the collection entities into the container.

Type Parameters

TEntity The type of the entity.

Parameters

entities The entities.
conflictResolution The conflict resolution.

Return Types

Attached entities.

public Task<IList> AttachEntitiesAsync(IEnumerable entities)

Attaches the collection entities into the container asynchronously.

Parameters

entities The entities.

Return Types

Attached entities.

public Task<IList> AttachEntitiesAsync(IEnumerable entities, EntityConflictResolution conflictResolution)

Attaches the collection entities into the container asynchronously.

Parameters

entities The entities.
conflictResolution The conflict resolution.

Return Types

Attached entities.

public Task<IList<TEntity>> AttachEntitiesAsync<TEntity>(IEnumerable entities, EntityConflictResolution conflictResolution)

Attaches the collection entities into the container asynchronously

Type Parameters

TEntity The type of the entity.

Parameters

entities The entities.
conflictResolution The conflict resolution.

Return Types

Attached entities.

public IEntity AttachEntity(IEntity entity)

Attaches the entity into the container.

Parameters

entity The entity.

public IEntity AttachEntity(IEntity entity, EntityConflictResolution conflictResolution)

Attaches the entity into the container.

Parameters

entity The entity.
conflictResolution The conflict resolution.

public void Clear<T>()

Clear container for specific entity.

Type Parameters

T Entity type.

public void Clear(Type type)

Clear container for specific entity.

Parameters

type Entity type.

public List<IEntity> FinalizeSaveChanges(IList<IEntity> entities, IList<KeyMapping> keyMappings)

Finalizes the save changes process.

Parameters

entities The entities to be saved.
keyMappings The key mappings.

Return Types

Saved entities.

public List<IEntity> FinalizeSaveChanges(IList<IEntity> entities, IList<KeyMapping> keyMappings, bool isSynchronizing)

Finalizes the save changes process.

Parameters

entities The entities to be saved.
keyMappings The key mappings.
isSynchronizing True if finalize save changes for synchronization process.

Return Types

Saved entities.

public List<IEntity> FinalizeSaveChanges(IList<KeyMapping> keyMappings)

Finalizes the save changes process

Parameters

keyMappings The key mappings.

Return Types

Saved entities.

public List<IEntity> FinalizeSaveChanges(IList<KeyMapping> keyMappings, bool isSynchronizing)

Finalizes the save changes process

Parameters

keyMappings The key mappings.
isSynchronizing True if finalize save changes for synchronization process.

Return Types

Saved entities.

public IEnumerable<IEntity> FindEntities(FindEntityState findEntityState)

Finds the entities with the specified state.

Parameters

findEntityState State of the find entity.

Return Types

Entities with the specified state.

public IEnumerable<T> FindEntities<T>(FindEntityState findEntityState)

Finds the entities of the specified type and state.

Type Parameters

T Entity type.

Parameters

findEntityState State of the find entity.

Return Types

Entities of the specified type and state.

public T FindEntity<T>(IEntity entity)

Finds the entity in the container given the type and the entity info.

Type Parameters

T Entity type.

Parameters

entity The entity.

Return Types

The entity.

public object FindEntity(Type entityType, IEntity entity)

Finds the entity in the container given the type and the entity info.

Parameters

entityType Entity type.
entity The entity.

Return Types

The entity.

public Dictionary<string, IEntity> GetContainer<T>()

Gets the container for the specified entity type.

Type Parameters

T Entity type.

Return Types

Container for the specified entity type.

public Dictionary<string, IEntity> GetContainer(Type type)

Gets the container for the specified entity type.

Parameters

type The entity type.

Return Types

Container for the specified entity type.

public IEnumerable<T> GetEntities<T>()

Gets the entities of the specified type.

Type Parameters

T Entity type.

Return Types

Entities of the specified type.

public T GetEntity<T>(object primaryKey, Object[] primaryKeys)

Gets the entity with the specified type given its primary key.

Type Parameters

T Entity type.

Parameters

primaryKey The primary key.
primaryKeys The primary keys.

Return Types

The entity.

public int GetTempIdentity()

Gets the temporary identity.

Return Types

Temporary identity

public IEnumerable<IEntity> PrepareSavedEntities()

Return collection of entities model that going to be saved. These entities models are simplified models without references to its related model. Which will be used as DTO for WebAPI services.

Return Types

Collection of entities model that going to be saved.

public IEntity PrepareSavedEntity(IEntity entity)

Return an entity model that going to be saved. This entity model is a simplified model without references to its related model. Which will be used as DTO for WebAPI services.

Parameters

entity The entity.

Return Types

An entity model that going to be saved.

public void RejectChanges()

Rejects all changes that currently tracked.

public void RejectChanges(IEnumerable entities)

Rejects the changes from the specified entities.

Parameters

entities The entities.

public void RemoveEntity(IEntity entity)

Removes the entity from the container.

Parameters

entity The entity that going to be removed.

public void ResetTempIdentity()

Resets the temporary identity counter.

public IList SynchronizeEntities(IEnumerable entities, DateTime lastSyncDate)

Synchronizes the entities.

Parameters

entities The entities to be synchronized.
lastSyncDate The last synchronize date.

Return Types

Synchronized entities.

public IList SynchronizeEntities(IEnumerable entities, DateTime lastSyncDate, EntityConflictResolution conflictResolution)

Synchronizes the entities.

Parameters

entities The entities to be synchronized.
lastSyncDate The last synchronize date.
conflictResolution The conflict resolution.

Return Types

Synchronized entities.

public IList<T> SynchronizeEntities<T>(IEnumerable entities, DateTime lastSyncDate, EntityConflictResolution conflictResolution)

Synchronizes the entities.

Type Parameters

T Type of the entity.

Parameters

entities The entities to be synchronized.
lastSyncDate The last synchronize date.
conflictResolution The conflict resolution.

Return Types

Synchronized entities.
  • No labels