public Context(DbConnection connection) : base(new DbContextOptionsBuilder <Context>().UseJet(connection).Options) { // NOT THE RIGHT PLACE TO DO THIS!!! _dbTreeInterceptor = new TenantCommandTreeInterceptor(); DbInterception.Add(_dbTreeInterceptor); }
public Context(DbConnection connection) : base(connection, false) { // NOT THE RIGHT PLACE TO DO THIS!!! _dbTreeInterceptor = new TenantCommandTreeInterceptor(); DbInterception.Add(_dbTreeInterceptor); }
public static void Add(IDbInterceptor interceptor) { if (!interceptors.Contains(interceptor)) { interceptors.Add(interceptor); } }
protected internal void Interceptor(IDbInterceptor interceptor) { Check.NotNull(interceptor, "interceptor"); _internalConfiguration.CheckNotLocked("Interceptor"); _internalConfiguration.RegisterSingleton(interceptor); }
public static void Add(IDbInterceptor interceptor) { lock (Sync) { interceptors = interceptors.Concat(new[] { interceptor }).ToArray(); } }
public CarsContext(DbConnection connection) : base(connection, false) { _dbInterceptor = new DbCommandInterceptor(); _dbTreeInterceptor = new DbCommandTreeInterceptor(); DbInterception.Add(_dbInterceptor); DbInterception.Add(_dbTreeInterceptor); }
public CarsContext(DbConnection connection) : base(new DbContextOptionsBuilder <CarsContext>().UseJet(connection).Options) { _dbInterceptor = new DbCommandInterceptor(); _dbTreeInterceptor = new DbCommandTreeInterceptor(); DbInterception.Add(_dbInterceptor); DbInterception.Add(_dbTreeInterceptor); }
public bool RemoveInterceptor(IDbInterceptor interceptor) { if (this.interceptors.Contains(interceptor)) { this.interceptors.Remove(interceptor); return(true); } return(false); }
internal virtual void RemoveInterceptor(IDbInterceptor interceptor) { DebugCheck.NotNull(interceptor); _commandTreeDispatcher.InternalDispatcher.Remove(interceptor); _commandDispatcher.InternalDispatcher.Remove(interceptor); _entityConnectionDispatcher.InternalDispatcher.Remove(interceptor); _cancelableCommandDispatcher.InternalDispatcher.Remove(interceptor); }
internal virtual void AddInterceptor(IDbInterceptor interceptor) { this._commandTreeDispatcher.InternalDispatcher.Add(interceptor); this._commandDispatcher.InternalDispatcher.Add(interceptor); this._transactionDispatcher.InternalDispatcher.Add(interceptor); this._dbConnectionDispatcher.InternalDispatcher.Add(interceptor); this._cancelableEntityConnectionDispatcher.InternalDispatcher.Add(interceptor); this._cancelableCommandDispatcher.InternalDispatcher.Add(interceptor); this._configurationDispatcher.InternalDispatcher.Add(interceptor); }
internal virtual void AddInterceptor(IDbInterceptor interceptor) { DebugCheck.NotNull(interceptor); _commandTreeDispatcher.InternalDispatcher.Add(interceptor); _commandDispatcher.InternalDispatcher.Add(interceptor); _transactionDispatcher.InternalDispatcher.Add(interceptor); _dbConnectionDispatcher.InternalDispatcher.Add(interceptor); _cancelableEntityConnectionDispatcher.InternalDispatcher.Add(interceptor); _cancelableCommandDispatcher.InternalDispatcher.Add(interceptor); }
internal virtual void AddInterceptor(IDbInterceptor interceptor) { DebugCheck.NotNull(interceptor); _commandTreeDispatcher.InternalDispatcher.Add(interceptor); _commandDispatcher.InternalDispatcher.Add(interceptor); _transactionDispatcher.InternalDispatcher.Add(interceptor); _dbConnectionDispatcher.InternalDispatcher.Add(interceptor); _cancelableEntityConnectionDispatcher.InternalDispatcher.Add(interceptor); _cancelableCommandDispatcher.InternalDispatcher.Add(interceptor); _configurationDispatcher.InternalDispatcher.Add(interceptor); }
public void Remove(IDbInterceptor interceptor) { TInterceptor interceptor1 = interceptor as TInterceptor; if ((object)interceptor1 == null) { return; } lock (this._lock) { List <TInterceptor> list = this._interceptors.ToList <TInterceptor>(); list.Remove(interceptor1); this._interceptors = list; } }
public void Remove(IDbInterceptor interceptor) { DebugCheck.NotNull(interceptor); var asThisType = interceptor as TInterceptor; if (asThisType == null) { return; } lock (_lock) { var newList = _interceptors.ToList(); newList.Remove(asThisType); _interceptors = newList; } }
public virtual IDbInterceptor CreateInterceptor() { object instance; try { instance = Activator.CreateInstance(Type.GetType(this.TypeName, true), this.Parameters.GetTypedParameterValues()); } catch (Exception ex) { throw new InvalidOperationException(Strings.InterceptorTypeNotFound((object)this.TypeName), ex); } IDbInterceptor dbInterceptor = instance as IDbInterceptor; if (dbInterceptor == null) { throw new InvalidOperationException(Strings.InterceptorTypeNotInterceptor((object)this.TypeName)); } return(dbInterceptor); }
/// <summary> /// Removes a registered <see cref="IDbInterceptor" /> so that it will no longer receive notifications. /// If the given interceptor is not registered, then this is a no-op. /// </summary> /// <param name="interceptor">The interceptor to remove.</param> public static void RemoveInterceptor(IDbInterceptor interceptor) { Check.NotNull(interceptor, "interceptor"); _dispatchers.RemoveInterceptor(interceptor); }
public static void Remove(IDbInterceptor interceptor) { interceptors.Remove(interceptor); }
// ReSharper disable once SuggestBaseTypeForParameter public AppDbContext(DbContextOptions <AppDbContext> options) : base(options) { _interceptor = this.GetService <IDbInterceptor>(); }
/// <summary> /// Removes a registered <see cref="T:System.Data.Entity.Infrastructure.Interception.IDbInterceptor" /> so that it will no longer receive notifications. /// If the given interceptor is not registered, then this is a no-op. /// </summary> /// <param name="interceptor">The interceptor to remove.</param> public static void Remove(IDbInterceptor interceptor) { Check.NotNull <IDbInterceptor>(interceptor, nameof(interceptor)); DbInterception._dispatchers.Value.RemoveInterceptor(interceptor); }
/// <summary> /// Registers a new <see cref="IDbInterceptor" /> to receive notifications. Note that the interceptor /// must implement some interface that extends from <see cref="IDbInterceptor" /> to be useful. /// </summary> /// <param name="interceptor">The interceptor to add.</param> public static void Add(IDbInterceptor interceptor) { Check.NotNull(interceptor, "interceptor"); _dispatchers.Value.AddInterceptor(interceptor); }
public bool RemoveInterceptor(IDbInterceptor interceptor) { Guard.IsNull(interceptor); return(this.interceptionManager.RemoveInterceptor(interceptor)); }
public void AddInterceptor(IDbInterceptor interceptor) { Guard.IsNull(interceptor); this.interceptionManager.AddInterceptor(interceptor); }
public ISession OpenSession(IDbInterceptor sessionLocalInterceptor) { throw new NotImplementedException(); }
public void RemoveInterceptor(IDbInterceptor dbInterceptor) => interceptors.Remove(dbInterceptor);
public void AddInterceptor(IDbInterceptor dbInterceptor) => interceptors.Add(dbInterceptor);
public void AddInterceptor(IDbInterceptor interceptor) { this.interceptors.Add(interceptor); }
/// <summary> /// Removes a registered <see cref="IDbInterceptor" /> so that it will no longer receive notifications. /// If the given interceptor is not registered, then this is a no-op. /// </summary> /// <param name="interceptor">The interceptor to remove.</param> public static void RemoveInterceptor(IDbInterceptor interceptor) { Check.NotNull(interceptor, "interceptor"); _dispatchers.Value.RemoveInterceptor(interceptor); }