public void New_interception_context_has_no_state()
        {
            var interceptionContext = new DbConfigurationInterceptionContext();

            Assert.Empty(interceptionContext.ObjectContexts);
            Assert.Empty(interceptionContext.DbContexts);
        }
示例#2
0
        public void New_interception_context_has_no_state()
        {
            var interceptionContext = new DbConfigurationInterceptionContext();

            Assert.Empty(interceptionContext.ObjectContexts);
            Assert.Empty(interceptionContext.DbContexts);
        }
示例#3
0
 void IDbConfigurationInterceptor.Loaded(
     DbConfigurationLoadedEventArgs loadedEventArgs,
     DbConfigurationInterceptionContext interceptionContext)
 {
     Check.NotNull <DbConfigurationLoadedEventArgs>(loadedEventArgs, nameof(loadedEventArgs));
     Check.NotNull <DbConfigurationInterceptionContext>(interceptionContext, nameof(interceptionContext));
     this.StartLogging(loadedEventArgs.DependencyResolver);
 }
示例#4
0
        public virtual void Loaded(
            DbConfigurationLoadedEventArgs loadedEventArgs,
            DbInterceptionContext interceptionContext)
        {
            DbConfigurationInterceptionContext clonedInterceptionContext = new DbConfigurationInterceptionContext(interceptionContext);

            this._internalDispatcher.Dispatch((Action <IDbConfigurationInterceptor>)(i => i.Loaded(loadedEventArgs, clonedInterceptionContext)));
        }
        public virtual void Loaded(DbConfigurationLoadedEventArgs loadedEventArgs, DbInterceptionContext interceptionContext)
        {
            DebugCheck.NotNull(loadedEventArgs);
            DebugCheck.NotNull(interceptionContext);

            var clonedInterceptionContext = new DbConfigurationInterceptionContext(interceptionContext);

            _internalDispatcher.Dispatch(i => i.Loaded(loadedEventArgs, clonedInterceptionContext));
        }
        public void Loaded(DbConfigurationLoadedEventArgs loadedEventArgs, DbConfigurationInterceptionContext interceptionContext)
        {
            var formatterFactory = loadedEventArgs.DependencyResolver
                                                  .GetService<Func<DbContext, Action<string>, DatabaseLogFormatter>>();

            var formatter = formatterFactory(null, (s) => { Debug.WriteLine(s); });

            DbInterception.Add(formatter);
        }
        public virtual void Loaded(DbConfigurationLoadedEventArgs loadedEventArgs, DbInterceptionContext interceptionContext)
        {
            DebugCheck.NotNull(loadedEventArgs);
            DebugCheck.NotNull(interceptionContext);

            var clonedInterceptionContext = new DbConfigurationInterceptionContext(interceptionContext);

            _internalDispatcher.Dispatch(i => i.Loaded(loadedEventArgs, clonedInterceptionContext));
        }
示例#8
0
        void IDbConfigurationInterceptor.Loaded(
            DbConfigurationLoadedEventArgs loadedEventArgs,
            DbConfigurationInterceptionContext interceptionContext)
        {
            Check.NotNull(loadedEventArgs, "loadedEventArgs");
            Check.NotNull(interceptionContext, "interceptionContext");

            StartLogging(loadedEventArgs.DependencyResolver);
        }
示例#9
0
        public void Cloning_the_interception_context_preserves_contextual_information_but_not_mutable_state()
        {
            var objectContext = new ObjectContext();
            var dbContext     = CreateDbContext(objectContext);

            var interceptionContext = new DbConfigurationInterceptionContext();

            interceptionContext = interceptionContext
                                  .WithDbContext(dbContext)
                                  .WithObjectContext(objectContext)
                                  .AsAsync();

            Assert.Equal(new[] { objectContext }, interceptionContext.ObjectContexts);
            Assert.Equal(new[] { dbContext }, interceptionContext.DbContexts);
            Assert.True(interceptionContext.IsAsync);
        }
        public void Cloning_the_interception_context_preserves_contextual_information_but_not_mutable_state()
        {
            var objectContext = new ObjectContext();
            var dbContext = CreateDbContext(objectContext);

            var interceptionContext = new DbConfigurationInterceptionContext();

            interceptionContext = interceptionContext
                .WithDbContext(dbContext)
                .WithObjectContext(objectContext)
                .AsAsync();

            Assert.Equal(new[] { objectContext }, interceptionContext.ObjectContexts);
            Assert.Equal(new[] { dbContext }, interceptionContext.DbContexts);
            Assert.True(interceptionContext.IsAsync);
        }
示例#11
0
 public void Loaded(DbConfigurationLoadedEventArgs loadedEventArgs,
                    DbConfigurationInterceptionContext interceptionContext)
 {
     var logger = new ExceptionLogger();
     _baseInfoQueue = new InfoQueue<BaseInfo>();
     var profiler = new DbProfiler(_baseInfoQueue)
     {
         AssembliesToExclude = new SortedSet<string>
         {
             typeof(DbProfiler).Assembly.GetName().Name,
             typeof(DatabaseLogger).Assembly.GetName().Name
         }
     };
     DbInterception.Add(new DatabaseInterceptor(profiler));
     _commandsTransmitter = new CommandsTransmitter(
         _baseInfoQueue, logger, new SimpleHttp(), _serverUri, LoggerPath.GetLogFileFullPath(_logFilePath));
     _commandsTransmitter.Start();
 }
 public void Loaded(
     DbConfigurationLoadedEventArgs loadedEventArgs,
     DbConfigurationInterceptionContext interceptionContext)
 {
     HooksRun.Push(_tag);
 }
 public void Loaded(
     DbConfigurationLoadedEventArgs loadedEventArgs,
     DbConfigurationInterceptionContext interceptionContext)
 {
     loadedEventArgs.AddDependencyResolver(MutableResolver.Instance, overrideConfigFile: true);
 }
 public abstract void Loaded(
     DbConfigurationLoadedEventArgs loadedEventArgs, DbConfigurationInterceptionContext interceptionContext);
 public void Loaded(
     DbConfigurationLoadedEventArgs loadedEventArgs, 
     DbConfigurationInterceptionContext interceptionContext)
 {
     Assert.Same(_snapshot, loadedEventArgs.DependencyResolver);
     Assert.NotNull(interceptionContext);
     Called++;
 }
示例#16
0
        void IDbConfigurationInterceptor.Loaded(
            DbConfigurationLoadedEventArgs loadedEventArgs,
            DbConfigurationInterceptionContext interceptionContext)
        {
            Check.NotNull(loadedEventArgs, "loadedEventArgs");
            Check.NotNull(interceptionContext, "interceptionContext");

            StartLogging(loadedEventArgs.DependencyResolver);
        }
示例#17
0
 public abstract void Loaded(
     DbConfigurationLoadedEventArgs loadedEventArgs, DbConfigurationInterceptionContext interceptionContext);