Ejemplo n.º 1
0
        public static AutofacDependencyResolver BuildContainer()
        {
            var builder = new ContainerBuilder();

            builder.RegisterControllers(typeof(MvcApplication).Assembly);
            builder.RegisterType <OperationStorage>().As <IOperationStorage>().SingleInstance();
            builder.RegisterType <ResultStorageStub>().As <IResultStorage>().SingleInstance();
            builder.Register(c => OperationLoggerStub.GetInstance()).As <IOperationLogger>().SingleInstance().ExternallyOwned();
            builder.Register(c => OperationStorage.GetInstance()).As <IOperationStorage>().SingleInstance();
            builder.RegisterType <OperationCreatorSelector>().AsSelf();
            var container = builder.Build();

            return(new AutofacDependencyResolver(container));
        }
Ejemplo n.º 2
0
        protected void Application_End()
        {
            var logger = OperationLoggerStub.GetInstance() as IDisposable;

            logger?.Dispose();
        }