/// <summary> /// 启动项注册 /// </summary> protected void ConfigureServices() { AutofacLocator autofacLocator = new AutofacLocator(); //创建IOC容器 autofacLocator.Register(); //注册服务 BootStrapper.Initialize(autofacLocator); }
/// <summary> /// 启动项注册 /// </summary> protected void ConfigureServices() { AutofacLocator autofacLocator = new AutofacLocator(); //创建IOC容器 Assembly asm = Assembly.GetExecutingAssembly(); autofacLocator.Register(asm); //注册服务 BootStrapper.Initialize(autofacLocator, asm); }
public App() { InitializeComponent(); Constants.InitAsync(Instance); AutofacLocator autofac = new AutofacLocator(); autofac.Register(); ServiceProvider.RegisterSerivceLocator(autofac); MainPage = new NavigationPage(new MainPage()); }
protected void ConfigureServices() { AutofacLocator locator = new AutofacLocator(); ContainerBuilder builder = new ContainerBuilder(); builder.RegisterType(typeof(LoginCenter)).Named("LoginCenter", typeof(IModuleDialog)); locator.Register(builder); AutofacProvider.RegisterServiceLocator(locator); }
protected void ConfigureServices() { AutofacLocator locator = new AutofacLocator(); ContainerBuilder builder = new ContainerBuilder(); builder.RegisterType <ConsumptionService>().As <IConsumptionService>(); builder.RegisterType(typeof(LoginCenter)).Named("LoginCenter", typeof(IModuleDialog)); builder.RegisterType(typeof(MainCenter)).Named("MainCenter", typeof(IModuleDialog)); builder.RegisterType(typeof(SkinCenter)).Named("SkinCenter", typeof(IModule)); builder.RegisterType(typeof(UserCenter)).Named("UserCenter", typeof(IModule)); builder.RegisterType(typeof(MenuCenter)).Named("MenuCenter", typeof(IModule)); builder.RegisterType(typeof(BasicCenter)).Named("BasicCenter", typeof(IModule)); locator.Register(builder); AutofacProvider.RegisterServiceLocator(locator); }