コード例 #1
0
 /// <summary>
 /// Implements the interface.  This causes the hook to only run for objects that are assignable to TEntity.
 /// </summary>
 public void Hook(object entity, HookEntityMetadata metadata, IUnitOfWork uow)
 {
     if (entity is TEntity typedEntity)
     {
         Hook(typedEntity, metadata, uow);
     }
 }
コード例 #2
0
 /// <summary>
 /// Implements the interface.  This causes the hook to only run for objects that are assignable to TEntity.
 /// </summary>
 public void Hook(object entity, HookEntityMetadata metadata, IDbContext dbContext)
 {
     if (entity is TEntity typedEntity)
     {
         Hook(typedEntity, metadata, dbContext);
     }
 }
コード例 #3
0
 /// <summary>
 ///     Implements the interface.  This causes the hook to only run for objects that are assignable to TEntity.
 /// </summary>
 public void Hook(object entity, HookEntityMetadata metadata)
 {
     if (entity is TEntity typedEntity)
     {
         Hook(typedEntity, metadata);
     }
 }
コード例 #4
0
 private void RunHooks <THook>(IEnumerable <EntityEntry> entries) where THook : IHook
 {
     foreach (var entry in entries)
     {
         var hooks = _provider.GetServices <THook>()
                     .Where(x => (x.HookState & entry.State) == entry.State);
         foreach (var hook in hooks)
         {
             var metadata = new HookEntityMetadata(entry);
             hook.Hook(entry.Entity, metadata);
         }
     }
 }
コード例 #5
0
 /// <summary>
 /// The logic to perform per entity before the registered action gets performed.
 /// This gets run once per entity that has been changed.
 /// </summary>
 protected abstract void Hook(TEntity entity, HookEntityMetadata metadata, IUnitOfWork uow);
コード例 #6
0
 /// <summary>
 /// The logic to perform per entity after the registered action gets performed.
 /// This gets run once per entity that has been changed.
 /// </summary>
 protected abstract void Hook(TEntity entity, HookEntityMetadata metadata, IDbContext context);
コード例 #7
0
 /// <summary>
 ///     The logic to perform per entity before the registered action gets performed.
 ///     This gets run once per entity that has been changed.
 /// </summary>
 /// <param name="entity">The entity that is processed by Entity Framework.</param>
 /// <param name="metadata">Metadata about the entity in the context of this hook - such as state.</param>
 protected abstract void Hook(TEntity entity, HookEntityMetadata metadata);