示例#1
0
        public void Init()
        {
            //初始化配置文件
            Assembly      entryAssembly = Assembly.GetExecutingAssembly();
            Configuration configuration = ConfigurationExtension.GetConfigurationFromAssembly(entryAssembly);

            FrameworkSection.Initialize(configuration);
            DependencyInjectionSection.Initialize(configuration);
            RedisSection.Initialize(configuration);

            if (!ResolveMediator.ContainerBuilt)
            {
                IServiceCollection builder = ResolveMediator.GetServiceCollection();
                builder.RegisterConfigs();

                ResolveMediator.Build();
            }

            DbSession dbSession = new DbSession();

            dbSession.Database.EnsureCreated();

            this._unitOfWork = ResolveMediator.Resolve <IUnitOfWorkStub>();

            GlobalSetting.InitCurrentSessionId();
        }
示例#2
0
        /// <summary>
        /// 初始化依赖注入容器
        /// </summary>
        static void InitContainer()
        {
            IServiceCollection builder = ResolveMediator.GetServiceCollection();

            builder.RegisterConfigs();

            ResolveMediator.Build();
        }
 /// <summary>
 /// 初始化容器
 /// </summary>
 private void InitContainer()
 {
     if (!ResolveMediator.ContainerBuilt)
     {
         IServiceCollection builder = ResolveMediator.GetServiceCollection();
         builder.RegisterConfigs();
         ResolveMediator.Build();
     }
 }
示例#4
0
 /// <summary>
 /// 配置应用程序
 /// </summary>
 protected override void Configure()
 {
     //初始化依赖注入容器
     if (!ResolveMediator.ContainerBuilt)
     {
         ContainerBuilder containerBuilder = ResolveMediator.GetContainerBuilder();
         containerBuilder.RegisterConfigs();
         ResolveMediator.Build();
     }
 }
示例#5
0
        /// <summary>
        /// 初始化依赖注入容器
        /// </summary>
        static void InitContainer()
        {
            if (!ResolveMediator.ContainerBuilt)
            {
                ContainerBuilder builder = ResolveMediator.GetContainerBuilder();
                builder.RegisterConfigs();

                ResolveMediator.Build();
            }
        }
示例#6
0
        public void Init()
        {
            if (!ResolveMediator.ContainerBuilt)
            {
                ContainerBuilder builder = ResolveMediator.GetContainerBuilder();
                builder.RegisterType(typeof(ProductContract)).As(typeof(IProductContract));

                ResolveMediator.Build();
            }
        }
示例#7
0
        public void Init()
        {
            if (!ResolveMediator.ContainerBuilt)
            {
                IServiceCollection builder = ResolveMediator.GetServiceCollection();
                builder.AddTransient(typeof(IProductContract), typeof(ProductContract));

                ResolveMediator.Build();
            }
        }
        public void Init()
        {
            if (!ResolveMediator.ContainerBuilt)
            {
                IServiceCollection builder = ResolveMediator.GetServiceCollection();
                builder.RegisterConfigs();

                ResolveMediator.Build();
            }

            ScheduleMediator.Clear();
        }
        /// <summary>
        /// 注册依赖注入解析者
        /// </summary>
        /// <param name="httpConfiguration">Http配置</param>
        public static void RegisterDependencyResolver(this HttpConfiguration httpConfiguration)
        {
            //初始化依赖注入容器
            if (!ResolveMediator.ContainerBuilt)
            {
                IServiceCollection builder = ResolveMediator.GetServiceCollection();
                builder.RegisterConfigs();

                ResolveMediator.Build();
            }

            httpConfiguration.DependencyResolver = new WebApiDependencyResolver();
        }
示例#10
0
        /// <summary>
        /// 创建服务建造者
        /// </summary>
        public IServiceCollection CreateBuilder(IServiceCollection services)
        {
            IServiceCollection builder = ResolveMediator.GetServiceCollection();

            foreach (ServiceDescriptor serviceDescriptor in services)
            {
                builder.Add(serviceDescriptor);
            }

            builder.RegisterConfigs();
            ResolveMediator.Build();

            return(builder);
        }
示例#11
0
        /// <summary>
        /// 配置应用程序
        /// </summary>
        protected override void Configure()
        {
            //配置自动更新服务
            AutoUpdater.Start(FrameworkSection.Setting.AutoUpdateService.Value);

            //初始化依赖注入容器
            if (!ResolveMediator.ContainerBuilt)
            {
                IServiceCollection serviceCollection = ResolveMediator.GetServiceCollection();
                serviceCollection.RegisterConfigs();
#if NETCOREAPP3_1_OR_GREATER
                serviceCollection.RegisterServiceModels();
#endif
                ResolveMediator.Build();
            }
        }
        public void Init()
        {
            //初始化依赖注入容器
            if (!ResolveMediator.ContainerBuilt)
            {
                IServiceCollection serviceCollection = ResolveMediator.GetServiceCollection();
                serviceCollection.RegisterConfigs();
                ResolveMediator.Build();
            }

            DbSession dbSession = new DbSession(GlobalSetting.WriteConnectionString);

            dbSession.Database.CreateIfNotExists();

            this._unitOfWork = ResolveMediator.Resolve <IUnitOfWorkStub>();
        }
示例#13
0
        public void Init()
        {
            //初始化配置文件
            Assembly      entryAssembly = Assembly.GetExecutingAssembly();
            Configuration configuration = ConfigurationExtension.GetConfigurationFromAssembly(entryAssembly);

            DependencyInjectionSection.Initialize(configuration);

            //初始化依赖注入容器
            if (!ResolveMediator.ContainerBuilt)
            {
                IServiceCollection builder = ResolveMediator.GetServiceCollection();
                builder.RegisterConfigs();

                ResolveMediator.Build();
            }
        }
示例#14
0
        public void Init()
        {
            if (!ResolveMediator.ContainerBuilt)
            {
                IServiceCollection builder = ResolveMediator.GetServiceCollection();
                builder.RegisterConfigs();

                ResolveMediator.Build();
            }

            DbSession dbSession = new DbSession();

            dbSession.Database.CreateIfNotExists();

            this._unitOfWork = ResolveMediator.Resolve <IUnitOfWorkStub>();

            GlobalSetting.InitCurrentSessionId();
        }
        /// <summary>
        /// 适用依赖注入
        /// </summary>
        /// <param name="serviceDescription">服务描述</param>
        /// <param name="serviceHostBase">服务主机</param>
        public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
        {
            //初始化容器
            if (!ResolveMediator.ContainerBuilt)
            {
                IServiceCollection builder = ResolveMediator.GetServiceCollection();
                builder.RegisterConfigs();

                ResolveMediator.Build();
            }

            foreach (ChannelDispatcherBase channelDispatcherBase in serviceHostBase.ChannelDispatchers)
            {
                ChannelDispatcher dispatcher = (ChannelDispatcher)channelDispatcherBase;
                foreach (EndpointDispatcher endpoint in dispatcher.Endpoints)
                {
                    if (!endpoint.IsSystemEndpoint)
                    {
                        endpoint.DispatchRuntime.InstanceProvider = new ServiceInstanceProvider(serviceDescription.ServiceType);
                    }
                }
            }
        }
        /// <summary>
        /// 配置应用程序
        /// </summary>
        protected override void Configure()
        {
            //初始化配置文件
            Assembly      entryAssembly = Assembly.GetExecutingAssembly();
            Configuration configuration = ConfigurationExtension.GetConfigurationFromAssembly(entryAssembly);

            ServiceModelSectionGroup.Initialize(configuration);
            FrameworkSection.Initialize(configuration);
            DependencyInjectionSection.Initialize(configuration);

            //初始化依赖注入容器
            if (!ResolveMediator.ContainerBuilt)
            {
                IServiceCollection serviceCollection = ResolveMediator.GetServiceCollection();
                serviceCollection.RegisterConfigs();
                serviceCollection.RegisterServiceModels();
                serviceCollection.RegisterNavigationService();

                ResolveMediator.Build();
            }

            //初始化消息组件
            UserDialogs.Init(this);
        }