public static void Initialize() { MvcBootstrapper mvcBootstrapper = new MvcBootstrapper(new ConventionalRegistrarConfig()); ApiBootstrapper apiBootstrapper = new ApiBootstrapper(mvcBootstrapper.IocManager); apiBootstrapper.Initialize(); //依赖注入初始化 mvcBootstrapper.Initialize(); apiBootstrapper.Initialize(); mvcBootstrapper.IocManager.Register <ISignInManager, IdentitySignInManager>(DependencyLifeStyle.Transient); }
public static IContainer SetupAutofac(this IServiceCollection services, Action <ContainerBuilder> configureDependencies = null) { var bootstrapper = new ApiBootstrapper(); return(bootstrapper.Initialize(x => { x.Populate(services); configureDependencies?.Invoke(x); })); }