コード例 #1
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();
        }
コード例 #2
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>();
        }
コード例 #3
0
        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);
        }