An Entity Framework DbContext that can be hooked into by registering EFHooks.IHook objects.
Inheritance: System.Data.DbContext
Exemplo n.º 1
0
 public HookRunner(HookedDbContext ctx)
 {
     this._ctx = ctx;
     this._modifiedEntries = ctx.ChangeTracker.Entries()
                                     .Where(x => x.State != EntityState.Unchanged && x.State != EntityState.Detached)
                                     .Select(x => new HookedEntityEntry()
                                     {
                                         Entity = x.Entity,
                                         PreSaveState = x.State
                                     })
                                     .ToArray();
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HookEntityMetadata" /> class.
 /// </summary>
 /// <param name="state">The state.</param>
 /// <param name="context">The optional existing context (I believe this is usable for migrations).</param>
 public HookEntityMetadata(EntityState state, HookedDbContext context = null)
 {
     _state         = state;
     CurrentContext = context;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HookEntityMetadata" /> class.
 /// </summary>
 /// <param name="state">The presave state.</param>
 /// <param name="entry">The db entry.</param>
 /// <param name="context">The existing context.</param>
 public HookEntityMetadata( EntityState state, HookedDbContext context, DbEntityEntry entry = null)
 {
     PreSaveState = state;
     CurrentEntry = entry;
     CurrentContext = context;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HookEntityMetadata" /> class.
 /// </summary>
 /// <param name="state">The state.</param>
 /// <param name="context">The optional existing context (I believe this is usable for migrations).</param>
 public HookEntityMetadata(EntityState state, HookedDbContext context = null)
 {
     _state = state;
     CurrentContext = context;
 }