Definition
Assembly: CloudNimble.EasyAF.Business.EF6.dll Namespace: CloudNimble.EasyAF.Business Inheritance: CloudNimble.EasyAF.Business.IdentifiableEntityManager<TContext, TEntity, TId>Syntax
Summary
A Manager inheriting fromIdentifiableEntityManager3` that contains reusable logic for updating a TEntity’s current State.
Type Parameters
TContext-TEntity-TId-TStateType-
Constructors
.ctor Inherited
Inherited from
CloudNimble.EasyAF.Business.IdentifiableEntityManager<TContext, TEntity, TId>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
dataContext | TContext | The DbContext instance to use for the database connection. Should be injected by the DI container. |
messagePublisher | CloudNimble.SimpleMessageBus.Publish.IMessagePublisher | The 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>EntityManager2` class.
Syntax
Parameters
| Name | Type | Description |
|---|---|---|
dataContext | TContext | The database context instance for data operations. Should be injected by the DI container. |
messagePublisher | CloudNimble.SimpleMessageBus.Publish.IMessagePublisher | The message publisher instance for publishing events. Should be injected by the DI container. |
.ctor Inherited
Inherited from
CloudNimble.EasyAF.Business.ManagerBase<TContext>ManagerBase1` class.
Syntax
Parameters
| Name | Type | Description |
|---|---|---|
dataContext | TContext | The database context instance for data operations. Should be injected by the DI container. |
messagePublisher | CloudNimble.SimpleMessageBus.Publish.IMessagePublisher | The message publisher instance for publishing events. Should be injected by the DI container. |
.ctor Inherited
Inherited from
objectSyntax
Properties
DataContext Inherited
Inherited from
CloudNimble.EasyAF.Business.ManagerBase<TContext>Syntax
Property Value
Type:TContext
MessagePublisher Inherited
Inherited from
CloudNimble.EasyAF.Business.ManagerBase<TContext>Syntax
Property Value
Type:CloudNimble.SimpleMessageBus.Publish.IMessagePublisher
StateTypes
Gets the collection of active state types available for entities managed by this manager. This collection is populated during initialization from the database.Syntax
Property Value
Type:System.Collections.Generic.List<TStateType>
Methods
DeleteAsync Inherited
Inherited from
CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entity | TEntity | - |
save | bool | - |
Returns
Type:System.Threading.Tasks.Task<bool>
DeleteAsync Inherited
Inherited from
CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entity | TEntity | - |
context | TContext | - |
save | bool | - |
Returns
Type:System.Threading.Tasks.Task<bool>
DeleteAsync Inherited
Inherited from
CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entities | System.Collections.Generic.List<TEntity> | - |
save | bool | - |
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>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entities | System.Collections.Generic.List<TEntity> | - |
context | TContext | - |
save | bool | - |
Returns
Type:System.Threading.Tasks.Task<bool>
DirectDelete Inherited
Inherited from
CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
predicate | System.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>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
predicate | System.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>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
predicate | System.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 |
updateExpression | System.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>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
predicate | System.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 |
updateExpression | System.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
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
obj | object? | - |
Returns
Type:bool
Equals Inherited
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
objA | object? | - |
objB | object? | - |
Returns
Type:bool
GetHashCode Inherited Virtual
Inherited from
objectSyntax
Returns
Type:int
GetType Inherited
Inherited from
objectSyntax
Returns
Type:System.Type
Initialize Virtual
Initializes the StateTypes collection by loading active state types from the database. This method is called automatically by state update methods if the collection is empty.Syntax
InsertAsync Inherited
Inherited from
CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entity | TEntity | The entity to be inserted. |
save | bool | Whether 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>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entity | TEntity | The entity to be inserted. |
context | TContext | The database context to use for the operation. |
save | bool | Whether 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>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entities | System.Collections.Generic.List<TEntity> | The collection of entities to be inserted. |
save | bool | Whether 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>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entities | System.Collections.Generic.List<TEntity> | The collection of entities to be inserted. |
context | TContext | The database context to use for the operation. |
save | bool | Whether 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
objectSyntax
Returns
Type:object
OnDeletedAsync Inherited Virtual
Inherited from
CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entity | TEntity | The 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>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entities | System.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>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entity | TEntity | The entity to be deleted. |
Returns
Type:System.Threading.Tasks.Task
OnDeletingAsync Inherited Virtual
Inherited from
CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entities | System.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>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entity | TEntity | The 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>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entities | System.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>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entity | TEntity | The TEntity to be inserted. |
Returns
Type:System.Threading.Tasks.Task
OnInsertingAsync Inherited Virtual
Inherited from
CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entity | TEntity | The 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>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entities | System.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>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entity | TEntity | The 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>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entities | System.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>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entity | TEntity | The 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>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entities | System.Collections.Generic.List<TEntity> | The collection of entities to be updated. |
Returns
Type:System.Threading.Tasks.Task
ReferenceEquals Inherited
Inherited from
objectSyntax
Parameters
| Name | Type | Description |
|---|---|---|
objA | object? | - |
objB | object? | - |
Returns
Type:bool
ResetAuditProperties Inherited
Inherited from
CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entity | TDbObservable | The 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.
SetCancelledAsync Virtual
Sets the entity’s state to “Cancelled” (sort order 98).Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entity | TEntity | The entity to update. |
Returns
Type:System.Threading.Tasks.Task<bool>
True if the state was successfully updated; otherwise, false.
SetCompletedAsync Virtual
Sets the entity’s state to “Completed” (sort order 100).Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entity | TEntity | The entity to update. |
Returns
Type:System.Threading.Tasks.Task<bool>
True if the state was successfully updated; otherwise, false.
SetCreatedAsync
Sets the entity’s state to “Created” (sort order 0).Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entity | TEntity | The entity to update. |
Returns
Type:System.Threading.Tasks.Task<bool>
True if the state was successfully updated; otherwise, false.
SetFailedAsync Virtual
Sets the entity’s state to “Failed” (sort order 99).Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entity | TEntity | The entity to update. |
errorMessage | string | Optional error message (currently not used in implementation). |
errorDetail | string | Optional error detail (currently not used in implementation). |
Returns
Type:System.Threading.Tasks.Task<bool>
True if the state was successfully updated; otherwise, false.
ToString Inherited Virtual
Inherited from
objectSyntax
Returns
Type:string?
UpdateAsync Inherited
Inherited from
CloudNimble.EasyAF.Business.EntityManager<TContext, TEntity>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entity | TEntity | The entity to be updated. |
save | bool | Whether 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>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entity | TEntity | The entity to be updated. |
context | TContext | The database context to use for the operation. |
save | bool | Whether 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>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entities | System.Collections.Generic.List<TEntity> | The collection of entities to be updated. |
save | bool | Whether 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>Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entities | System.Collections.Generic.List<TEntity> | The collection of entities to be updated. |
context | TContext | The database context to use for the operation. |
save | bool | Whether 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.
UpdateStateAsync
Updates the entity’s state to the state type with the specified sort order. Logs the state transition for tracking purposes.Syntax
Parameters
| Name | Type | Description |
|---|---|---|
entity | TEntity | The entity to update. |
sortOrder | int | The sort order of the target state type. |
Returns
Type:System.Threading.Tasks.Task<bool>
True if the state was successfully updated; otherwise, false.
Exceptions
| Exception | Description |
|---|---|
Exception | Thrown when no state type is found with the specified sort order. |