Example #1
0
 void IDbConfigurationInterceptor.Loaded(
     DbConfigurationLoadedEventArgs loadedEventArgs,
     DbConfigurationInterceptionContext interceptionContext)
 {
     Check.NotNull <DbConfigurationLoadedEventArgs>(loadedEventArgs, nameof(loadedEventArgs));
     Check.NotNull <DbConfigurationInterceptionContext>(interceptionContext, nameof(interceptionContext));
     this.StartLogging(loadedEventArgs.DependencyResolver);
 }
Example #2
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));
        }
Example #4
0
        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 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);
        }
Example #6
0
        void IDbConfigurationInterceptor.Loaded(
            DbConfigurationLoadedEventArgs loadedEventArgs,
            DbConfigurationInterceptionContext interceptionContext)
        {
            Check.NotNull(loadedEventArgs, "loadedEventArgs");
            Check.NotNull(interceptionContext, "interceptionContext");

            StartLogging(loadedEventArgs.DependencyResolver);
        }
        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));
        }
        private static void OnDbConfigurationLoaded(
            object sender,
            DbConfigurationLoadedEventArgs e)
        {
            e.AddDependencyResolver(
                new SingletonDependencyResolver <DbProviderServices>(
                    DataReaderInspectorProviderServices.Instance,
                    ProviderInvariantName),
                false);

            e.AddDependencyResolver(
                new SingletonDependencyResolver <IProviderInvariantName>(
                    DataReaderInspectorInvariantName.Instance,
                    DataReaderInspectorProviderFactory.Instance),
                false);
        }
        private static void OnDbConfigurationLoaded(
            object sender, 
            DbConfigurationLoadedEventArgs e)
        {
            e.AddDependencyResolver(
                new SingletonDependencyResolver<DbProviderServices>(
                    DataReaderInspectorProviderServices.Instance,
                    ProviderInvariantName),
                false);

            e.AddDependencyResolver(
                new SingletonDependencyResolver<IProviderInvariantName>(
                        DataReaderInspectorInvariantName.Instance,
                        DataReaderInspectorProviderFactory.Instance),
                false);
        }
        public void Loaded_dispatches_to_interceptors()
        {
            var interceptionContext = new DbInterceptionContext();
            var eventArgs = new DbConfigurationLoadedEventArgs(new Mock<InternalConfiguration>(null, null, null, null, null).Object);
            var mockInterceptor1 = new Mock<IDbConfigurationInterceptor>();
            var mockInterceptor2 = new Mock<IDbConfigurationInterceptor>();

            var dispatcher = new DbConfigurationDispatcher();
            var internalDispatcher = dispatcher.InternalDispatcher;
            internalDispatcher.Add(mockInterceptor1.Object);
            internalDispatcher.Add(mockInterceptor2.Object);

            dispatcher.Loaded(eventArgs, interceptionContext);

            mockInterceptor1.Verify(m => m.Loaded(eventArgs, It.IsAny<DbConfigurationInterceptionContext>()), Times.Once());
            mockInterceptor2.Verify(m => m.Loaded(eventArgs, It.IsAny<DbConfigurationInterceptionContext>()), Times.Once());
        }
        public void Loaded_dispatches_to_interceptors()
        {
            var interceptionContext = new DbInterceptionContext();
            var eventArgs           = new DbConfigurationLoadedEventArgs(new Mock <InternalConfiguration>(null, null, null, null, null).Object);
            var mockInterceptor1    = new Mock <IDbConfigurationInterceptor>();
            var mockInterceptor2    = new Mock <IDbConfigurationInterceptor>();

            var dispatcher         = new DbConfigurationDispatcher();
            var internalDispatcher = dispatcher.InternalDispatcher;

            internalDispatcher.Add(mockInterceptor1.Object);
            internalDispatcher.Add(mockInterceptor2.Object);

            dispatcher.Loaded(eventArgs, interceptionContext);

            mockInterceptor1.Verify(m => m.Loaded(eventArgs, It.IsAny <DbConfigurationInterceptionContext>()), Times.Once());
            mockInterceptor2.Verify(m => m.Loaded(eventArgs, It.IsAny <DbConfigurationInterceptionContext>()), Times.Once());
        }
Example #12
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();
 }
Example #13
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();
        }
Example #14
0
 public void Loaded(
     DbConfigurationLoadedEventArgs loadedEventArgs,
     DbConfigurationInterceptionContext interceptionContext)
 {
     TestLoadedInterceptor.HooksRun.Push(_tag);
 }
 private static void OnLoaded(object sender, DbConfigurationLoadedEventArgs eventArgs)
 {
     throw new NotImplementedException();
 }
 public void Loaded(
     DbConfigurationLoadedEventArgs loadedEventArgs,
     DbConfigurationInterceptionContext interceptionContext)
 {
     HooksRun.Push(_tag);
 }
 public abstract void Loaded(
     DbConfigurationLoadedEventArgs loadedEventArgs, DbConfigurationInterceptionContext interceptionContext);
Example #18
0
 private void Handler3(object sender, DbConfigurationLoadedEventArgs args)
 {
     Assert.Same(_configuration.Object.Owner, sender);
     Assert.Same(_snapshot, args.DependencyResolver);
     Handler3Called++;
 }
 private static void Hook1(object sender, DbConfigurationLoadedEventArgs eventArgs)
 {
     DbConfigurationTests.HooksRun.Add("Hook1");
 }
 public static void Perfect(object sender, DbConfigurationLoadedEventArgs args)
 {
 }
 public static int WagonWheel(object sender, DbConfigurationLoadedEventArgs args)
 {
     return(0);
 }
 public void MakeUp(object sender, DbConfigurationLoadedEventArgs args)
 {
 }
 public abstract void Loaded(
     DbConfigurationLoadedEventArgs loadedEventArgs, DbConfigurationInterceptionContext interceptionContext);
Example #24
0
        void IDbConfigurationInterceptor.Loaded(
            DbConfigurationLoadedEventArgs loadedEventArgs,
            DbConfigurationInterceptionContext interceptionContext)
        {
            Check.NotNull(loadedEventArgs, "loadedEventArgs");
            Check.NotNull(interceptionContext, "interceptionContext");

            StartLogging(loadedEventArgs.DependencyResolver);
        }
Example #25
0
 static void DbConfiguration_Loaded(object sender, DbConfigurationLoadedEventArgs e)
 {
     e.AddDependencyResolver(new WrappingEfAutofacResolver(e.DependencyResolver, Container), true);
 }
 private static void OnLoaded(object sender, DbConfigurationLoadedEventArgs eventArgs)
 {
     throw new NotImplementedException();
 }
        public virtual void OnLoaded(InternalConfiguration configuration)
        {
            DebugCheck.NotNull(configuration);

            var eventArgs = new DbConfigurationLoadedEventArgs(configuration);

            var handler = _loadedHandler;
            if (handler != null)
            {
                handler(configuration.Owner, eventArgs);
            }

            configuration.DispatchLoadedInterceptors(eventArgs);
        }
 private static void Hook2(object sender, DbConfigurationLoadedEventArgs eventArgs)
 {
     HooksRun.Add("Hook2");
 }
 private static void Day(object sender, DbConfigurationLoadedEventArgs args)
 {
 }
 public void Loaded(
     DbConfigurationLoadedEventArgs loadedEventArgs,
     DbConfigurationInterceptionContext interceptionContext)
 {
     loadedEventArgs.AddDependencyResolver(MutableResolver.Instance, overrideConfigFile: true);
 }
 public void Loaded(
     DbConfigurationLoadedEventArgs loadedEventArgs, 
     DbConfigurationInterceptionContext interceptionContext)
 {
     Assert.Same(_snapshot, loadedEventArgs.DependencyResolver);
     Assert.NotNull(interceptionContext);
     Called++;
 }