Beispiel #1
0
 protected abstract void SetupRegisterHook(IDbHookRegistrar registrar, Action <IDbHook> registerAction);
 /// <summary>
 /// Registers the hook.
 /// </summary>
 /// <param name="dbHookRegistrar">The database hook registrar.</param>
 /// <param name="hook">The hook.</param>
 protected override void RegisterHook(IDbHookRegistrar dbHookRegistrar, IDbHook hook)
 {
     dbHookRegistrar.RegisterLoadHook(hook);
 }
Beispiel #3
0
 protected abstract IInvokeSetup <T> CreateTypedHookSetup <T>(IDbHookRegistrar dbHookRegistrar) where T : class;
 /// <summary>
 /// Initializes a new instance of the <see cref="LoadConditionalSetup{T}"/> class.
 /// </summary>
 /// <param name="dbHookRegistrar">The database hook registrar.</param>
 /// <param name="predicate">The predicate.</param>
 public LoadConditionalSetup(IDbHookRegistrar dbHookRegistrar, Predicate <T> predicate)
     : base(dbHookRegistrar, predicate, EntityState.Unchanged | EntityState.Modified | EntityState.Deleted | EntityState.Added)
 {
 }
 /// <summary>
 /// Called when one more condition is set up.
 /// </summary>
 /// <param name="dbHookRegistrar">The database hook registrar.</param>
 /// <param name="predicate">The predicate.</param>
 /// <param name="entityState">State of the entity.</param>
 /// <returns>The setup for a hook.</returns>
 protected override IConditionalSetup <T> OnAnd(IDbHookRegistrar dbHookRegistrar, Predicate <T> predicate, EntityState entityState)
 {
     return(new LoadConditionalSetup <T>(dbHookRegistrar, predicate));
 }
Beispiel #6
0
 /// <summary>
 /// Called when one more condition is set up.
 /// </summary>
 /// <param name="dbHookRegistrar">The database hook registrar.</param>
 /// <param name="predicate">The predicate.</param>
 /// <param name="entityState">State of the entity.</param>
 /// <returns>The setup for a hook.</returns>
 protected abstract IConditionalSetup <T> OnAnd(IDbHookRegistrar dbHookRegistrar, Predicate <T> predicate, EntityState entityState);
Beispiel #7
0
 /// <summary>
 /// Registers the hook.
 /// </summary>
 /// <param name="dbHookRegistrar">The database hook registrar.</param>
 /// <param name="hook">The hook.</param>
 protected abstract void RegisterHook(IDbHookRegistrar dbHookRegistrar, IDbHook hook);
 public void SetUp()
 {
     _registrar    = Substitute.For <IDbHookRegistrar>();
     _hook         = Substitute.For <IDbHook>();
     _hookAttacher = new SaveHookAttacher(_registrar);
 }
Beispiel #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConditionalSetup{T}"/> class.
 /// </summary>
 /// <param name="dbHookRegistrar">The database hook registrar.</param>
 /// <param name="predicate">The predicate.</param>
 /// <param name="entityState">State of the entity.</param>
 protected ConditionalSetup(IDbHookRegistrar dbHookRegistrar, Predicate <T> predicate, EntityState entityState)
 {
     _dbHookRegistrar = dbHookRegistrar;
     _predicate       = predicate;
     _entityState     = entityState;
 }
 protected override void SetupRegisterHook(IDbHookRegistrar registrar, Action <IDbHook> registerAction)
 {
     registrar.When(hookRegistrar => hookRegistrar.RegisterLoadHook(Arg.Any <IDbHook>())).Do(info => registerAction(info.Arg <IDbHook>()));
 }
Beispiel #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SaveSetup{T}"/> class.
 /// </summary>
 /// <param name="dbHookRegistrar">The database hook registrar.</param>
 public SaveSetup(IDbHookRegistrar dbHookRegistrar)
 {
     _dbHookRegistrar = dbHookRegistrar;
 }
Beispiel #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LoadSetup{T}"/> class.
 /// </summary>
 /// <param name="dbHookRegistrar">The database hook registrar.</param>
 public LoadSetup(IDbHookRegistrar dbHookRegistrar)
 {
     _dbHookRegistrar = dbHookRegistrar;
 }
 /// <summary>
 /// Spicifies the setup for a hook, that should be called while loading entity of specified type.
 /// </summary>
 /// <typeparam name="T">Type of the entity.</typeparam>
 /// <param name="dbHookRegistrar">The database hook registrar.</param>
 /// <returns>The setup for a hook.</returns>
 public static ILoadSetup <T> OnLoad <T>(this IDbHookRegistrar dbHookRegistrar) where T : class
 {
     return(dbHookRegistrar.CreateHook().OnLoad <T>());
 }
 /// <summary>
 /// Returns Fluent API interface for attaching hooks on <see cref="IDbHookRegistrar"/>.
 /// </summary>
 /// <param name="dbHookRegistrar">The database hook registrar.</param>
 /// <returns>Fluent api entry point.</returns>
 public static IHookSetup CreateHook(this IDbHookRegistrar dbHookRegistrar)
 {
     return(new HookSetup(dbHookRegistrar));
 }
Beispiel #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SaveConditionalSetup{T}"/> class.
 /// </summary>
 /// <param name="dbHookRegistrar">The database hook registrar.</param>
 /// <param name="predicate">The predicate.</param>
 /// <param name="entityState">State of the entity.</param>
 public SaveConditionalSetup(IDbHookRegistrar dbHookRegistrar, Predicate <T> predicate, EntityState entityState)
     : base(dbHookRegistrar, predicate, entityState)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LoadHookAttacher"/> class.
 /// </summary>
 /// <param name="dbHookRegistrar">The database hook registrar.</param>
 public LoadHookAttacher(IDbHookRegistrar dbHookRegistrar)
 {
     _dbHookRegistrar = dbHookRegistrar;
 }