示例#1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            var _container = new ContainerBuilder();

            AutofacContainer.AutofacContainer autofacContainer = new AutofacContainer.AutofacContainer(_container);
            autofacContainer.RegisterTypes();
            _container.RegisterControllers(typeof(Choosify.WebApiApplication).Assembly);

            var x = _container.Build();

            DependencyResolver.SetResolver(new AutofacDependencyResolver(x));

            //ContainerBuilder cb = new ContainerBuilder();
            //cb.RegisterType<ApplicationLogic>().As<IApplicationLogic>().InstancePerLifetimeScope();



            //var twEngine = new TweetEngine();
            //twe
            //TweetEngine.Initialize();
        }
示例#2
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            var _container = new ContainerBuilder();
            AutofacContainer.AutofacContainer autofacContainer = new AutofacContainer.AutofacContainer(_container);
            autofacContainer.RegisterTypes();
            _container.RegisterControllers(typeof(Choosify.WebApiApplication).Assembly);

            var x = _container.Build();
            DependencyResolver.SetResolver(new AutofacDependencyResolver(x));

            //ContainerBuilder cb = new ContainerBuilder();
            //cb.RegisterType<ApplicationLogic>().As<IApplicationLogic>().InstancePerLifetimeScope();

            //var twEngine = new TweetEngine();
            //twe
            //TweetEngine.Initialize();
        }