示例#1
0
 internal InterceptorPool(InterceptorPool previousPool, IStateInterceptor interceptor)
     : this(previousPool.DbContext, previousPool.Interceptors, interceptor)
 {
 }
示例#2
0
 private InterceptorPool(DbContext dbContext, IEnumerable <IStateInterceptor> previousInterceptors, IStateInterceptor interceptor)
 {
     DbContext    = dbContext;
     Interceptors = previousInterceptors.Union(Enumerable.Repeat(interceptor, 1));
 }
示例#3
0
 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));
 }
示例#6
0
 /// <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);
 }
示例#7
0
        /// <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));
        }