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(); }
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>(); }
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> public OrderCheckedEventHandler(IUnitOfWorkStub unitOfWork) { this._unitOfWork = unitOfWork; }