/// <summary> /// Configures the <see cref="EntityDbContextOptions"/> to use a post-save hook delegate. /// The delegate's <para>success</para> parameter will indicate if the /// save succeeded. /// </summary> /// <param name="hook">The delegate to be called after saving.</param> /// <returns>An <see cref="EntityDbContextOptionsBuilder"/> that can be used to further configure options.</returns> public virtual EntityDbContextOptionsBuilder UsePostSaveHook(EntityDbContextSaveHooks.PostSaveHook hook) { var saveHook = new EntityDbContextSaveHooks(null, hook, null); ((List <EntityDbContextSaveHooks>)Options.SaveHooks).Add(saveHook); return(this); }
/// <summary> /// Configures the <see cref="EntityDbContextOptions"/> to use a class that implements /// <see cref="IEntitySaveHook"/> to process both pre-save and post-save /// hook calls. /// </summary> /// <typeparam name="T">The type that implements <see cref="IEntitySaveHook"/>.</typeparam> /// <returns>An <see cref="EntityDbContextOptionsBuilder"/> that can be used to further configure options.</returns> public virtual EntityDbContextOptionsBuilder UseSaveHook <T>() where T : IEntitySaveHook { var saveHook = new EntityDbContextSaveHooks(null, null, typeof(T)); ((List <EntityDbContextSaveHooks>)Options.SaveHooks).Add(saveHook); return(this); }