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); }
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); }