Пример #1
0
        public static AppStartup StartWebApi(this AppStartup startup)
        {
            startup.Start();

            if (EasyAutofac.Container == null)
            {
                throw new Exception("请先加载IoC容器");
            }

            GlobalConfiguration.Configuration.DependencyResolver = new AutofacWebApiDependencyResolver(EasyAutofac.Container);

            return(startup);
        }
Пример #2
0
        public static AppStartup StartMvc(this AppStartup startup)
        {
            startup.Start();

            if (EasyAutofac.Container == null)
            {
                throw new Exception("请先加载IoC容器");
            }

            DependencyResolver.SetResolver(new AutofacDependencyResolver(EasyAutofac.Container));

            return(startup);
        }