Skip to main content

Definition

Assembly: CloudNimble.EasyAF.Business.EF6.dll Namespace: CloudNimble.EasyAF.Business Inheritance: CloudNimble.EasyAF.Business.IdentifiableEntityManager<TContext, TEntity, TId>

Syntax

CloudNimble.EasyAF.Business.StatusEntityManager<TContext, TEntity, TId, TStatusType>

Summary

A Manager inheriting from IdentifiableEntityManager3` that contains reusable logic for updating a TEntity’s current Status.

Type Parameters

  • TContext -
  • TEntity -
  • TId -
  • TStatusType -

Constructors

.ctor Inherited

Inherited from CloudNimble.EasyAF.Business.IdentifiableEntityManager<TContext, TEntity, TId>
Create a new instance of the given Manager for a given DbContext.

Syntax

public IdentifiableEntityManager(TContext dataContext, CloudNimble.SimpleMessageBus.Publish.IMessagePublisher messagePublisher)

Parameters

NameTypeDescription
dataContextTContextThe DbContext instance to use for the database connection. Should be injected by the DI container.
messagePublisherCloudNimble.SimpleMessageBus.Publish.IMessagePublisherThe SimpleMessageBus IMessagePublisher instance to use to publish Messages to a Queue. Should be injected by the DI container.

.ctor Inherited

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Initializes a new instance of the EntityManager2` class.

Syntax

public EntityManager(TContext dataContext, CloudNimble.SimpleMessageBus.Publish.IMessagePublisher messagePublisher)

Parameters

NameTypeDescription
dataContextTContextThe database context instance for data operations. Should be injected by the DI container.
messagePublisherCloudNimble.SimpleMessageBus.Publish.IMessagePublisherThe message publisher instance for publishing events. Should be injected by the DI container.

.ctor Inherited

Inherited from CloudNimble.EasyAF.Business.ManagerBase<TContext>
Initializes a new instance of the ManagerBase1` class.

Syntax

public ManagerBase(TContext dataContext, CloudNimble.SimpleMessageBus.Publish.IMessagePublisher messagePublisher)

Parameters

NameTypeDescription
dataContextTContextThe database context instance for data operations. Should be injected by the DI container.
messagePublisherCloudNimble.SimpleMessageBus.Publish.IMessagePublisherThe message publisher instance for publishing events. Should be injected by the DI container.

.ctor Inherited

Inherited from object

Syntax

public Object()

Properties

DataContext Inherited

Inherited from CloudNimble.EasyAF.Business.ManagerBase<TContext>
Gets the database context instance used for data operations. This context is injected through the constructor and provides access to the database.

Syntax

public TContext DataContext { get; private set; }

Property Value

Type: TContext

MessagePublisher Inherited

Inherited from CloudNimble.EasyAF.Business.ManagerBase<TContext>
Gets the message publisher instance used for publishing events and messages to the message bus. This publisher is injected through the constructor and enables event-driven architecture patterns.

Syntax

public CloudNimble.SimpleMessageBus.Publish.IMessagePublisher MessagePublisher { get; private set; }

Property Value

Type: CloudNimble.SimpleMessageBus.Publish.IMessagePublisher

StatusTypes

Gets the collection of active status types available for entities managed by this manager. This collection is populated during initialization from the database.

Syntax

public System.Collections.Generic.List<TStatusType> StatusTypes { get; private set; }

Property Value

Type: System.Collections.Generic.List<TStatusType>

Methods

DeleteAsync Inherited

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Delete a specific DbSet`1 with optional save operation.

Syntax

public System.Threading.Tasks.Task<bool> DeleteAsync(TEntity entity, bool save = true)

Parameters

NameTypeDescription
entityTEntity-
savebool-

Returns

Type: System.Threading.Tasks.Task<bool>

DeleteAsync Inherited

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Delete a specific DbSet`1 with optional save operation using a specified DbContext.

Syntax

public System.Threading.Tasks.Task<bool> DeleteAsync(TEntity entity, TContext context, bool save = true)

Parameters

NameTypeDescription
entityTEntity-
contextTContext-
savebool-

Returns

Type: System.Threading.Tasks.Task<bool>

DeleteAsync Inherited

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Delete all DbSet`1 from a list with optional save operation.

Syntax

public System.Threading.Tasks.Task<bool> DeleteAsync(System.Collections.Generic.List<TEntity> entities, bool save = true)

Parameters

NameTypeDescription
entitiesSystem.Collections.Generic.List<TEntity>-
savebool-

Returns

Type: System.Threading.Tasks.Task<bool>

Remarks

RWM: This will need to be Deleted to be generic if it’s going to be in a NuGet package.

DeleteAsync Inherited

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Delete all DbSet`1 from a list with optional save operation using a specified DbContext.

Syntax

public System.Threading.Tasks.Task<bool> DeleteAsync(System.Collections.Generic.List<TEntity> entities, TContext context, bool save = true)

Parameters

NameTypeDescription
entitiesSystem.Collections.Generic.List<TEntity>-
contextTContext-
savebool-

Returns

Type: System.Threading.Tasks.Task<bool>

DirectDelete Inherited

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Delete entities returned by the specified query without individual entity processing.

Syntax

public int DirectDelete(System.Linq.Expressions.Expression<System.Func<TEntity, bool>> predicate)

Parameters

NameTypeDescription
predicateSystem.Linq.Expressions.Expression<System.Func<TEntity, bool>>An Expression1](https://learn.microsoft.com/dotnet/api/system.linq.expressions.expression-1) to execute against the [DbSet1

Returns

Type: int

Remarks

This overload will give you all of the performance of deleting a set of data without loading entities in the context but none of the extra processing provided by OnDeleting / OnDeleted.

DirectDeleteAsync Inherited

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Delete entities returned by the specified query without individual entity processing.

Syntax

public System.Threading.Tasks.Task<int> DirectDeleteAsync(System.Linq.Expressions.Expression<System.Func<TEntity, bool>> predicate)

Parameters

NameTypeDescription
predicateSystem.Linq.Expressions.Expression<System.Func<TEntity, bool>>An Expression1](https://learn.microsoft.com/dotnet/api/system.linq.expressions.expression-1) to execute against the [DbSet1

Returns

Type: System.Threading.Tasks.Task<int>

Remarks

This overload will give you all of the performance of deleting a set of data without loading entities in the context but none of the extra processing provided by OnDeleting / OnDeleted.

DirectUpdate Inherited

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Executes a direct UPDATE query on the database without returning objects or processing them through the interceptors.

Syntax

public int DirectUpdate(System.Linq.Expressions.Expression<System.Func<TEntity, bool>> predicate, System.Linq.Expressions.Expression<System.Func<TEntity, TEntity>> updateExpression)

Parameters

NameTypeDescription
predicateSystem.Linq.Expressions.Expression<System.Func<TEntity, bool>>An Expression1](https://learn.microsoft.com/dotnet/api/system.linq.expressions.expression-1) to execute against the [DbSet1
updateExpressionSystem.Linq.Expressions.Expression<System.Func<TEntity, TEntity>>An Expression`1 defining the updates to be performed on the records returned by the predicate.

Returns

Type: int

Remarks

This overload will give you all of the performance of updating a set of data without loading entities in the context but none of the extra processing provided by OnUpdating / OnUpdated.

DirectUpdateAsync Inherited

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Executes a direct UPDATE query on the database without returning objects or processing them through the interceptors.

Syntax

public System.Threading.Tasks.Task<int> DirectUpdateAsync(System.Linq.Expressions.Expression<System.Func<TEntity, bool>> predicate, System.Linq.Expressions.Expression<System.Func<TEntity, TEntity>> updateExpression)

Parameters

NameTypeDescription
predicateSystem.Linq.Expressions.Expression<System.Func<TEntity, bool>>An Expression1](https://learn.microsoft.com/dotnet/api/system.linq.expressions.expression-1) to execute against the [DbSet1
updateExpressionSystem.Linq.Expressions.Expression<System.Func<TEntity, TEntity>>An Expression`1 defining the updates to be performed on the records returned by the predicate.

Returns

Type: System.Threading.Tasks.Task<int>

Remarks

This overload will give you all of the performance of updating a set of data without loading entities in the context but none of the extra processing provided by OnUpdating / OnUpdated.

Equals Inherited Virtual

Inherited from object

Syntax

public virtual bool Equals(object obj)

Parameters

NameTypeDescription
objobject?-

Returns

Type: bool

Equals Inherited

Inherited from object

Syntax

public static bool Equals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

GetHashCode Inherited Virtual

Inherited from object

Syntax

public virtual int GetHashCode()

Returns

Type: int

GetType Inherited

Inherited from object

Syntax

public System.Type GetType()

Returns

Type: System.Type

Initialize Virtual

Initializes the StatusTypes collection by loading active status types from the database. This method is called automatically by status update methods if the collection is empty.

Syntax

public virtual void Initialize()

InsertAsync Inherited

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Inserts a single entity into the database with optional save operation. Executes the OnInsertingAsync and OnInsertedAsync lifecycle hooks.

Syntax

public System.Threading.Tasks.Task<bool> InsertAsync(TEntity entity, bool save = true)

Parameters

NameTypeDescription
entityTEntityThe entity to be inserted.
saveboolWhether to immediately save changes to the database. Defaults to true.

Returns

Type: System.Threading.Tasks.Task<bool> True if the entity was successfully inserted; otherwise, false.

Remarks

RWM: This will need to be updated to be generic if it’s going to be in a NuGet package.

InsertAsync Inherited

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Inserts a single entity into the database using a specified context with optional save operation. Executes the OnInsertingAsync and OnInsertedAsync lifecycle hooks.

Syntax

public System.Threading.Tasks.Task<bool> InsertAsync(TEntity entity, TContext context, bool save = true)

Parameters

NameTypeDescription
entityTEntityThe entity to be inserted.
contextTContextThe database context to use for the operation.
saveboolWhether to immediately save changes to the database. Defaults to true.

Returns

Type: System.Threading.Tasks.Task<bool> True if the entity was successfully inserted; otherwise, false.

InsertAsync Inherited

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Inserts a collection of entities into the database with optional save operation. Executes the OnInsertingAsync and OnInsertedAsync lifecycle hooks for each entity.

Syntax

public System.Threading.Tasks.Task<bool> InsertAsync(System.Collections.Generic.List<TEntity> entities, bool save = true)

Parameters

NameTypeDescription
entitiesSystem.Collections.Generic.List<TEntity>The collection of entities to be inserted.
saveboolWhether to immediately save changes to the database. Defaults to true.

Returns

Type: System.Threading.Tasks.Task<bool> True if the entities were successfully inserted; otherwise, false.

Remarks

RWM: This will need to be updated to be generic if it’s going to be in a NuGet package.

InsertAsync Inherited

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Inserts a collection of entities into the database using a specified context with optional save operation. Executes the OnInsertingAsync and OnInsertedAsync lifecycle hooks for each entity.

Syntax

public System.Threading.Tasks.Task<bool> InsertAsync(System.Collections.Generic.List<TEntity> entities, TContext context, bool save = true)

Parameters

NameTypeDescription
entitiesSystem.Collections.Generic.List<TEntity>The collection of entities to be inserted.
contextTContextThe database context to use for the operation.
saveboolWhether to immediately save changes to the database. Defaults to true.

Returns

Type: System.Threading.Tasks.Task<bool> True if the entities were successfully inserted; otherwise, false.

MemberwiseClone Inherited

Inherited from object

Syntax

protected internal object MemberwiseClone()

Returns

Type: object

OnDeletedAsync Inherited Virtual

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Called after successfully deleting an entity from the database. Use this method for post-deletion business logic such as cleanup operations, sending notifications, or triggering external systems.

Syntax

public virtual System.Threading.Tasks.Task<bool> OnDeletedAsync(TEntity entity)

Parameters

NameTypeDescription
entityTEntityThe entity that was deleted.

Returns

Type: System.Threading.Tasks.Task<bool> True if post-deletion processing was successful; otherwise, false.

OnDeletedAsync Inherited Virtual

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Called after successfully deleting a collection of entities from the database. Applies OnDeletedAsync logic to each entity in the collection.

Syntax

public virtual System.Threading.Tasks.Task OnDeletedAsync(System.Collections.Generic.List<TEntity> entities)

Parameters

NameTypeDescription
entitiesSystem.Collections.Generic.List<TEntity>The collection of entities that were deleted.

Returns

Type: System.Threading.Tasks.Task

OnDeletingAsync Inherited Virtual

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Called before deleting an entity from the database. Override this method to add custom business logic or validation before deletion.

Syntax

public virtual System.Threading.Tasks.Task OnDeletingAsync(TEntity entity)

Parameters

NameTypeDescription
entityTEntityThe entity to be deleted.

Returns

Type: System.Threading.Tasks.Task

OnDeletingAsync Inherited Virtual

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Called before deleting a collection of entities from the database. Applies OnDeletingAsync logic to each entity in the collection.

Syntax

public virtual System.Threading.Tasks.Task OnDeletingAsync(System.Collections.Generic.List<TEntity> entities)

Parameters

NameTypeDescription
entitiesSystem.Collections.Generic.List<TEntity>The collection of entities to be deleted.

Returns

Type: System.Threading.Tasks.Task

OnInsertedAsync Inherited Virtual

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Called after successfully inserting an entity into the database. Use this method for post-insertion business logic such as sending notifications, publishing events, or triggering external systems.

Syntax

public virtual System.Threading.Tasks.Task<bool> OnInsertedAsync(TEntity entity)

Parameters

NameTypeDescription
entityTEntityThe entity that was inserted.

Returns

Type: System.Threading.Tasks.Task<bool> True if post-insertion processing was successful; otherwise, false.

OnInsertedAsync Inherited Virtual

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Called after successfully inserting a collection of entities into the database. Applies OnInsertedAsync logic to each entity in the collection.

Syntax

public virtual System.Threading.Tasks.Task OnInsertedAsync(System.Collections.Generic.List<TEntity> entities)

Parameters

NameTypeDescription
entitiesSystem.Collections.Generic.List<TEntity>The collection of entities that were inserted.

Returns

Type: System.Threading.Tasks.Task

OnInsertingAsync Override

Inherited from CloudNimble.EasyAF.Business.IdentifiableEntityManager<TContext, TEntity, TId>
Perform business logic (like setting the entity’s Id) prior to saving the TEntity to the TContext.

Syntax

public override System.Threading.Tasks.Task OnInsertingAsync(TEntity entity)

Parameters

NameTypeDescription
entityTEntityThe TEntity to be inserted.

Returns

Type: System.Threading.Tasks.Task

OnInsertingAsync Inherited Virtual

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Called before inserting an entity into the database. Automatically handles audit field population and user tracking for entities implementing the appropriate interfaces.

Syntax

public virtual System.Threading.Tasks.Task OnInsertingAsync(TEntity entity)

Parameters

NameTypeDescription
entityTEntityThe entity to be inserted.

Returns

Type: System.Threading.Tasks.Task

Remarks

This method automatically sets:
  • CreatedById for entities implementing ICreatorTrackable1`
  • DateCreated for entities implementing ICreatedAuditable Override this method to add custom business logic before insertion.

OnInsertingAsync Inherited

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Called before inserting a collection of entities into the database. Applies OnInsertingAsync logic to each entity in the collection.

Syntax

public System.Threading.Tasks.Task OnInsertingAsync(System.Collections.Generic.List<TEntity> entities)

Parameters

NameTypeDescription
entitiesSystem.Collections.Generic.List<TEntity>The collection of entities to be inserted.

Returns

Type: System.Threading.Tasks.Task

OnUpdatedAsync Inherited Virtual

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Called after successfully updating an entity in the database. Use this method for post-update business logic such as sending notifications, publishing events, or triggering external systems.

Syntax

public virtual System.Threading.Tasks.Task<bool> OnUpdatedAsync(TEntity entity)

Parameters

NameTypeDescription
entityTEntityThe entity that was updated.

Returns

Type: System.Threading.Tasks.Task<bool> True if post-update processing was successful; otherwise, false.

OnUpdatedAsync Inherited Virtual

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Called after successfully updating a collection of entities in the database. Applies OnUpdatedAsync logic to each entity in the collection.

Syntax

public virtual System.Threading.Tasks.Task OnUpdatedAsync(System.Collections.Generic.List<TEntity> entities)

Parameters

NameTypeDescription
entitiesSystem.Collections.Generic.List<TEntity>The collection of entities that were updated.

Returns

Type: System.Threading.Tasks.Task

OnUpdatingAsync Inherited Virtual

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Called before updating an entity in the database. Automatically handles audit field population and user tracking for entities implementing the appropriate interfaces.

Syntax

public virtual System.Threading.Tasks.Task OnUpdatingAsync(TEntity entity)

Parameters

NameTypeDescription
entityTEntityThe entity to be updated.

Returns

Type: System.Threading.Tasks.Task

Remarks

This method automatically sets:
  • UpdatedById for entities implementing IUpdaterTrackable1`
  • DateUpdated for entities implementing IUpdatedAuditable Override this method to add custom business logic before updating.

OnUpdatingAsync Inherited Virtual

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Called before updating a collection of entities in the database. Applies OnUpdatingAsync logic to each entity in the collection.

Syntax

public virtual System.Threading.Tasks.Task OnUpdatingAsync(System.Collections.Generic.List<TEntity> entities)

Parameters

NameTypeDescription
entitiesSystem.Collections.Generic.List<TEntity>The collection of entities to be updated.

Returns

Type: System.Threading.Tasks.Task

ReferenceEquals Inherited

Inherited from object

Syntax

public static bool ReferenceEquals(object objA, object objB)

Parameters

NameTypeDescription
objAobject?-
objBobject?-

Returns

Type: bool

ResetAuditProperties Inherited

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Resets audit properties to an “Inserted” state by setting creation fields and clearing update fields. Sets CreatedById and DateCreated to current values, while clearing UpdatedById and DateUpdated.

Syntax

public void ResetAuditProperties<TDbObservable>(TDbObservable entity) where TDbObservable : CloudNimble.EasyAF.Core.DbObservableObject

Parameters

NameTypeDescription
entityTDbObservableThe entity whose audit properties should be reset.

Type Parameters

  • TDbObservable - Any DbObservableObject in the object model. DOES NOT have to be the entity for this Manager.

ToString Inherited Virtual

Inherited from object

Syntax

public virtual string ToString()

Returns

Type: string?

UpdateAsync Inherited

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Updates a single entity in the database with optional save operation. Executes the OnUpdatingAsync and OnUpdatedAsync lifecycle hooks.

Syntax

public System.Threading.Tasks.Task<bool> UpdateAsync(TEntity entity, bool save = true)

Parameters

NameTypeDescription
entityTEntityThe entity to be updated.
saveboolWhether to immediately save changes to the database. Defaults to true.

Returns

Type: System.Threading.Tasks.Task<bool> True if the entity was successfully updated; otherwise, false.

Remarks

RWM: This will need to be updated to be generic if it’s going to be in a NuGet package.

UpdateAsync Inherited

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Updates a single entity in the database using a specified context with optional save operation. Executes the OnUpdatingAsync and OnUpdatedAsync lifecycle hooks.

Syntax

public System.Threading.Tasks.Task<bool> UpdateAsync(TEntity entity, TContext context, bool save = true)

Parameters

NameTypeDescription
entityTEntityThe entity to be updated.
contextTContextThe database context to use for the operation.
saveboolWhether to immediately save changes to the database. Defaults to true.

Returns

Type: System.Threading.Tasks.Task<bool> True if the entity was successfully updated; otherwise, false.

UpdateAsync Inherited

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Updates a collection of entities in the database with optional save operation. Executes the OnUpdatingAsync and OnUpdatedAsync lifecycle hooks for each entity.

Syntax

public System.Threading.Tasks.Task<bool> UpdateAsync(System.Collections.Generic.List<TEntity> entities, bool save = true)

Parameters

NameTypeDescription
entitiesSystem.Collections.Generic.List<TEntity>The collection of entities to be updated.
saveboolWhether to immediately save changes to the database. Defaults to true.

Returns

Type: System.Threading.Tasks.Task<bool> True if the entities were successfully updated; otherwise, false.

Remarks

RWM: This will need to be updated to be generic if it’s going to be in a NuGet package.

UpdateAsync Inherited

Inherited from CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>
Updates a collection of entities in the database using a specified context with optional save operation. Executes the OnUpdatingAsync and OnUpdatedAsync lifecycle hooks for each entity.

Syntax

public System.Threading.Tasks.Task<bool> UpdateAsync(System.Collections.Generic.List<TEntity> entities, TContext context, bool save = true)

Parameters

NameTypeDescription
entitiesSystem.Collections.Generic.List<TEntity>The collection of entities to be updated.
contextTContextThe database context to use for the operation.
saveboolWhether to immediately save changes to the database. Defaults to true.

Returns

Type: System.Threading.Tasks.Task<bool> True if the entities were successfully updated; otherwise, false.

UpdateStatusAsync

Updates the entity’s status to the status type with the specified sort order. Logs the status transition for tracking purposes.

Syntax

public System.Threading.Tasks.Task<bool> UpdateStatusAsync(TEntity entity, int sortOrder)

Parameters

NameTypeDescription
entityTEntityThe entity to update.
sortOrderintThe sort order of the target status type.

Returns

Type: System.Threading.Tasks.Task<bool> True if the status was successfully updated; otherwise, false.

Exceptions

ExceptionDescription
ExceptionThrown when no status type is found with the specified sort order.