internal InterceptorPool(InterceptorPool previousPool, IStateInterceptor interceptor) : this(previousPool.DbContext, previousPool.Interceptors, interceptor) { }
private InterceptorPool(DbContext dbContext, IEnumerable <IStateInterceptor> previousInterceptors, IStateInterceptor interceptor) { DbContext = dbContext; Interceptors = previousInterceptors.Union(Enumerable.Repeat(interceptor, 1)); }
internal InterceptorPool(DbContext dbContext, IStateInterceptor interceptor) : this(dbContext, Enumerable.Empty <IStateInterceptor>(), interceptor) { }
/// <summary> /// Injects interceptor implementing <see cref="IStateInterceptor"/> into <see cref="DbContextExtensions.ApplyChanges(DbContext, ITrackable)"/>. /// </summary> /// <param name="pool">Pool of interceptors.</param> /// <param name="interceptor">Instance of <see cref="IStateInterceptor"/></param> public static InterceptorPool WithInterceptor(this InterceptorPool pool, IStateInterceptor interceptor) { return(new InterceptorPool(pool, interceptor)); }
/// <summary> /// Injects interceptor implementing <see cref="IStateInterceptor"/> intto <see cref="DbContextExtensions.ApplyChanges(DbContext, ITrackable)"/>. /// </summary> /// <param name="dbContext"><see cref="DbContext"/> used to query and save changes to a database</param> /// <param name="interceptor">Instance of <see cref="IStateInterceptor"/></param> public static InterceptorPool WithInterceptor(this DbContext dbContext, IStateInterceptor interceptor) { return(new InterceptorPool(dbContext, interceptor)); }
/// <summary> /// Injects interceptor implementing <see cref="IStateInterceptor"/> into <see cref="DbContextExtensions.ApplyChanges(DbContext, ITrackable)"/>. /// </summary> /// <param name="pool">Pool of interceptors.</param> /// <param name="interceptor">Instance of <see cref="IStateInterceptor"/></param> public static InterceptorPool WithInterceptor(this InterceptorPool pool, IStateInterceptor interceptor) { pool.Interceptors.Add(interceptor); return(pool); }
/// <summary> /// Injects interceptor implementing <see cref="IStateInterceptor"/> intto <see cref="DbContextExtensions.ApplyChanges(DbContext, ITrackable)"/>. /// </summary> /// <param name="dbContext"><see cref="DbContext"/> used to query and save changes to a database</param> /// <param name="interceptor">Instance of <see cref="IStateInterceptor"/></param> public static InterceptorPool WithInterceptor(this DbContext dbContext, IStateInterceptor interceptor) { var pool = new InterceptorPool(dbContext); return(WithInterceptor(pool, interceptor)); }