Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        public static void Register()
        {
            var moduleInitializers = new ModuleInitializer[]
            {
                new JuCheapModuleInitializer()
            };

            _mapperConfiguration = new MapperConfiguration(cfg =>
            {
                moduleInitializers.ForEach(m => m.LoadAutoMapper(cfg));
            });
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        public static void Register()
        {
            var moduleInitializers = new ModuleInitializer[]
            {
                new AdminCoreModuleInitializer(),
                new YunKeModuleInitializer(),
            };

            _mapperConfiguration = new MapperConfiguration(cfg =>
            {
                moduleInitializers.ForEach(m => m.LoadAutoMapper(cfg));
            });
        }
Ejemplo n.º 3
0
        /// <summary>
        /// RegisterForWebApiProxyClient
        /// </summary>
        /// <param name="container"></param>
        private static void RegisterForWebApiProxyClient(Container container)
        {
            //dbcontext
            container.Register <IDbContextScopeFactory>(() => new DbContextScopeFactory(), Lifestyle.Scoped);

            //service
            var moduleInitializers = new ModuleInitializer[]
            {
                new JuCheapModuleInitializer()
            };

            moduleInitializers.ForEach(x => x.LoadIoc(container));

            //automapper
            container.Register <IConfigurationProvider>(AutoMapperConfig.GetMapperConfiguration, Lifestyle.Singleton);
            container.Register(() => AutoMapperConfig.GetMapperConfiguration().CreateMapper(), Lifestyle.Scoped);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// RegisterForWebApiProxyClient
        /// </summary>
        /// <param name="container"></param>
        private static void InitializeContainer(Container container)
        {
            //dbcontext
            container.Register <IDbContextScopeFactory>(() => new DbContextScopeFactory(), Lifestyle.Scoped);

            //service
            var moduleInitializers = new ModuleInitializer[]
            {
                new JuCheapModuleInitializer(),
                new JuCheapJobInitializer()
            };

            moduleInitializers.ForEach(x => x.LoadIoc(container));

            var updateJob = typeof(SystemUpdateJobService);

            container.Register(updateJob, updateJob, Lifestyle.Scoped);

            //automapper
            container.Register <IConfigurationProvider>(AutoMapperConfig.GetMapperConfiguration, Lifestyle.Singleton);
            container.Register(() => AutoMapperConfig.GetMapperConfiguration().CreateMapper(), Lifestyle.Scoped);
        }
Ejemplo n.º 5
0
        public static void Register(Container container)
        {
            //dbcontext
            container.Register <IDbContextScopeFactory>(() => new DbContextScopeFactory(), Lifestyle.Scoped);

            //service
            var moduleInitializers = new ModuleInitializer[]
            {
                new AdminCoreModuleInitializer(),
                new WxModuleInitializer(),
                new RedisCacheModuleInitializer(),
            };

            moduleInitializers.ForEach(x => x.LoadIoc(container));

            container.Register <ISmsCodeService, SmsCodeService>();
            container.Register <ISmsSender, SmsSender>();
            container.RegisterSingleton <ISmsAccountProvider, AppSettingSmsAccountProvider>();

            container.Register <IQueryBus, InProcessQueryBus>();
            container.Register <ICommandBus, InProgressCommandBus>();
            container.Register <IUnitOfWork, YunKeDbContextRepositoryUnitOfWork>(Lifestyle.Scoped);
            container.Register(typeof(IRepository <>), typeof(RepositoryBase <>), Lifestyle.Scoped);
        }