示例#1
0
 public static void RegisterIoc(this IIocManager iocManager)
 {
     iocManager.RegisterAssemblyByConvention(typeof(OrderWebModule).GetAssembly());
     iocManager.RegisterIfNot <IOrderAppService, OrderAppService>(DependencyLifeStyle.Transient);
     iocManager.RegisterIfNot <IApplicationInjector, ApplicationInjector>(DependencyLifeStyle.Transient);
     iocManager.RegisterIfNot <IBasketAppService, BasketAppService>(DependencyLifeStyle.Transient);
 }
示例#2
0
        public IntegratedTestBase()
        {
            LocalIocManager = new IocManager();
            LocalIocManager.IocContainer.Install(new FinderInstaller());
            LocalIocManager.AddConventionalRegistrar(new BasicConventionalRegistrar());
            LocalIocManager.RegisterAssemblyByConvention(typeof(IRepository).Assembly);
            LocalIocManager.RegisterAssemblyByConvention(typeof(DomainServiceBase).Assembly);
            LocalIocManager.RegisterAssemblyByConvention(typeof(AppServiceBase).Assembly);

            LocalIocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());

            LocalIocManager.RegisterAssemblyByConvention(Assembly.Load("DDD.Domain.Common"));
            LocalIocManager.RegisterAssemblyByConvention(Assembly.Load("DDD.Domain.Core"));
            LocalIocManager.RegisterAssemblyByConvention(Assembly.Load("DDD.Domain.Service"));

            LocalIocManager.IocContainer.Register(
                Component.For(typeof(IDbContextProvider <>))
                .ImplementedBy(typeof(UnitOfWorkDbContextProvider <>))
                .LifestyleTransient(),
                Component.For <IUnitOfWorkDefaultOptions, UnitOfWorkDefaultOptions>().ImplementedBy <UnitOfWorkDefaultOptions>().LifestyleSingleton(),
                Component.For <IIocResolver, IocManager>().ImplementedBy <IocManager>().LifestyleSingleton()
                );

            //UnitOfWorkRegistrar.Initialize(LocalIocManager);
            InitalAutoMapper();
        }
        public static void InitalizeIocRegistrations(IIocManager ioc)
        {
            var thisAssembly = typeof(ResponsibleSystemApplicationModule).GetAssembly();

            ioc.RegisterAssemblyByConvention(thisAssembly);
            ioc.Register <ISessionService, SessionService>();
            ioc.Register <HttpClient, HttpClient>(DependencyLifeStyle.Transient);
            ioc.Register <ICryptoService, CryptoService>(); // TODO: sprawdzić czy nie jest zbędne
        }
示例#4
0
        public static void RegisterIoc(this IIocManager iocManager)
        {
            iocManager.RegisterAssemblyByConvention(typeof(ItemsWebModule).GetAssembly());
            iocManager.RegisterIfNot <IBrandAppService, BrandAppService>(DependencyLifeStyle.Transient);
            iocManager.RegisterIfNot <IItemAppService, ItemAppService>(DependencyLifeStyle.Transient);
            iocManager.RegisterIfNot <IApplicationInjector, ApplicationInjector>(DependencyLifeStyle.Transient);

            iocManager.RegisterIfNot <RedisContext <Brand>, RedisContext <Brand> >(DependencyLifeStyle.Transient);
            iocManager.RegisterIfNot <RedisContext <Item>, RedisContext <Item> >(DependencyLifeStyle.Transient);
        }
示例#5
0
        public TestBaseWithLocalIocManager()
        {
            LocalIocManager = new IocManager();


            /*
             * 需要注意注册的次序!
             * 先注册拦截器
             */

            //开启uow事务
            UnitOfWorkRegistrar.Initialize(LocalIocManager);

            LocalIocManager.IocContainer.Register(
                Component.For(typeof(IDbContextProvider <>)).ImplementedBy(typeof(UnitOfWorkDbContextProvider <>)).LifestyleTransient(),
                Component.For <IUnitOfWorkDefaultOptions, UnitOfWorkDefaultOptions>().ImplementedBy <UnitOfWorkDefaultOptions>().LifestyleSingleton(),
                Component.For <IIocResolver, IocManager>().ImplementedBy <IocManager>().LifestyleSingleton(),
                Component.For <IUnitOfWorkManager>().ImplementedBy <UnitOfWorkManager>().LifestyleSingleton()
                );

            LocalIocManager.Register(typeof(UnitOfWorkInterceptor), DependencyLifeStyle.Singleton);

            //IocManager.Register<HelpController>(DependencyLifeStyle.Transient);

            LocalIocManager.IocContainer.Install(new FinderInstaller());
            LocalIocManager.AddConventionalRegistrar(new BasicConventionalRegistrar());

            LocalIocManager.RegisterAssemblyByConvention(typeof(IRepository).Assembly);
            LocalIocManager.RegisterAssemblyByConvention(typeof(DomainServiceBase).Assembly);
            LocalIocManager.RegisterAssemblyByConvention(typeof(AppServiceBase).Assembly);
            //LocalIocManager.RegisterAssemblyByConvention(typeof(TestBaseWithLocalIocManager).Assembly);

            //LocalIocManager.RegisterAssemblyByConvention(Assembly.Load("DDD.Domain.Common"));
            LocalIocManager.RegisterAssemblyByConvention(Assembly.Load("DDD.Domain.Core"));
            LocalIocManager.RegisterAssemblyByConvention(Assembly.Load("DDD.Domain.Service"));
            //IocManager.Register<IBlogRepository>();
            //IocManager.Register<IUserRepository>();
        }
        public OracleTestBaseWithLocalIocManager()
        {
            LocalIocManager = new IocManager();


            /*
             * 需要注意注册的次序!
             * 先注册拦截器
             */

            //开启uow事务
            UnitOfWorkRegistrar.Initialize(LocalIocManager);

            LocalIocManager.IocContainer.Register(
                Component.For(typeof(IDbContextProvider <>)).ImplementedBy(typeof(UnitOfWorkDbContextProvider <>)).LifestyleTransient(),
                Component.For <IUnitOfWorkDefaultOptions, UnitOfWorkDefaultOptions>().ImplementedBy <UnitOfWorkDefaultOptions>().LifestyleSingleton(),
                Component.For <IIocResolver, IocManager>().ImplementedBy <IocManager>().LifestyleSingleton(),
                Component.For <IUnitOfWorkManager>().ImplementedBy <UnitOfWorkManager>().LifestyleSingleton()
                //Component.For<IAutoMapperInitializer, AutoMapperInitializer>().ImplementedBy<AutoMapperInitializer>().LifestyleSingleton()
                );


            LocalIocManager.Register(typeof(UnitOfWorkInterceptor), DependencyLifeStyle.Singleton);


            //IocManager.Register<HelpController>(DependencyLifeStyle.Transient);

            LocalIocManager.IocContainer.Install(new FinderInstaller());
            LocalIocManager.AddConventionalRegistrar(new BasicConventionalRegistrar());

            LocalIocManager.RegisterAssemblyByConvention(typeof(IAutoMapperModule).Assembly);
            LocalIocManager.RegisterAssemblyByConvention(typeof(IInfrastructureDomainModule).Assembly);
            LocalIocManager.RegisterAssemblyByConvention(typeof(IDomainCoreModule).Assembly);
            LocalIocManager.RegisterAssemblyByConvention(typeof(IDomainServiceModule).Assembly);
            LocalIocManager.RegisterAssemblyByConvention(typeof(IAppServiceModule).Assembly);
        }
示例#7
0
 public static void RegisterAssembly(IIocManager iocManager)
 {
     iocManager.RegisterAssemblyByConvention(typeof(QksPluginDbContext).GetAssembly());
 }
示例#8
0
 public void Initialize(IIocManager iocManager)
 {
     iocManager.RegisterAssemblyByConvention(Assembly.GetAssembly(typeof(UsuarioService)));
 }
 public static void RegisterAssemblyByConventionEx(this IIocManager iocManager, Assembly assembly)
 {
     iocManager.RegisterAssemblyByConvention(assembly);
 }