public BizService(IAppServiceProvider provider, string currentUserName) { _monitor = new Monitor("BizService session"); _dataContext = provider.Get <IMultiDataContext>(); CurrentUserName = currentUserName; Provider = provider; UserRepo = Provider.Get <IUserRepository>(); var serviceRegistrator = Provider.Get <IAppServiceProviderRegistrator>(); serviceRegistrator.AddService(new UserDataProvider(CurrentUserId, CurrentUserName)); EnumRepo = Provider.Get <IEnumRepository>(); DocRepo = Provider.Get <IDocRepository>(); DocDefRepo = Provider.Get <IDocDefRepository>(); FormRepo = Provider.Get <IFormRepository>(); var workflowRepo = Provider.Get <IWorkflowRepository>(); WorkflowRepo = workflowRepo; WorkflowEngine = Provider.Get <IWorkflowEngine>(); ReportGeneratorProvider = Provider.Get <ITemplateReportGeneratorProvider>(); LangRepo = Provider.Get <ILanguageRepository>(); _sqlQueryBuilderFactory = Provider.Get <ISqlQueryBuilderFactory>(); _sqlQueryReaderFactory = Provider.Get <ISqlQueryReaderFactory>(); _comboBoxValueProvider = Provider.Get <IComboBoxEnumProvider>(); _id = RegisterProcess(CurrentUserId, CurrentUserName); }
// private static readonly Logger Log = LogManager.GetCurrentClassLogger(); public BizService() { try { _monitor = new Monitor("BizService session"); /*Connection = new EntityConnection("name=cissaEntities"); * _ownConnection = true;*/ CurrentUserName = ServiceSecurityContext.Current.PrimaryIdentity.Name; // Log.Info(string.Format("Система запущена пользователем {0}", CurrentUserName)); //var dc = new DataContext(Connection); var dataContextFactory = DataContextFactoryProvider.GetFactory(); _dataContext = dataContextFactory.CreateMultiDc(BaseServiceFactory.DataContextConfigSectionName); //new MultiDataContext(/*new[] {dc}*/); _ownDataContext = true; var providerFactory = AppServiceProviderFactoryProvider.GetFactory(); Provider = providerFactory.Create(DataContext); UserRepo = Provider.Get <IUserRepository>(); // new UserRepository(Provider); var serviceRegistrator = Provider.Get <IAppServiceProviderRegistrator>(); serviceRegistrator.AddService(new UserDataProvider(CurrentUserId, CurrentUserName)); EnumRepo = Provider.Get <IEnumRepository>(); //new EnumRepository(Provider); DocRepo = Provider.Get <IDocRepository>(); //new DocRepository(DataContext, CurrentUserId); DocDefRepo = Provider.Get <IDocDefRepository>(); FormRepo = Provider.Get <IFormRepository>(); //new FormRepository(DataContext, CurrentUserId); var workflowRepo = Provider.Get <IWorkflowRepository>(); //new WorkflowRepository(DataContext); WorkflowRepo = workflowRepo; WorkflowEngine = Provider.Get <IWorkflowEngine>(); //new WorkflowEngine(DataContext, workflowRepo, CurrentUserId); ReportGeneratorProvider = Provider.Get <ITemplateReportGeneratorProvider>(); //new TemplateReportGeneratorProvider(DataContext, CurrentUserId); //PdfTempRepo = new PdfTemplateRepository(DataContext, CurrentUserId); //ExcelTempRepo = new ExcelTemplateRepository(DataContext, CurrentUserId); LangRepo = Provider.Get <ILanguageRepository>(); _sqlQueryBuilderFactory = Provider.Get <ISqlQueryBuilderFactory>(); _sqlQueryReaderFactory = Provider.Get <ISqlQueryReaderFactory>(); _comboBoxValueProvider = Provider.Get <IComboBoxEnumProvider>(); _id = RegisterProcess(CurrentUserId, CurrentUserName); } catch (Exception e) { Logger.OutputLog(e, "BizService construction"); throw; } }
public BizService(string userName) { _monitor = new Monitor("BizService session"); /*Connection = new EntityConnection("name=cissaEntities"); * _ownConnection = true;*/ CurrentUserName = userName; //var dc = new DataContext(Connection); var dataContextFactory = DataContextFactoryProvider.GetFactory(); _dataContext = dataContextFactory.CreateMultiDc(BaseServiceFactory.DataContextConfigSectionName); //new MultiDataContext(/*new[] { dc }*/); _ownDataContext = true; var providerFactory = AppServiceProviderFactoryProvider.GetFactory(); Provider = providerFactory.Create(DataContext); UserRepo = Provider.Get <IUserRepository>(); // new UserRepository(Provider); var serviceRegistrator = Provider.Get <IAppServiceProviderRegistrator>(); serviceRegistrator.AddService(new UserDataProvider(CurrentUserId, CurrentUserName)); EnumRepo = Provider.Get <IEnumRepository>(); //new EnumRepository(Provider); DocRepo = Provider.Get <IDocRepository>(); //new DocRepository(DataContext, CurrentUserId); DocDefRepo = Provider.Get <IDocDefRepository>(); FormRepo = Provider.Get <IFormRepository>(); //new FormRepository(DataContext, CurrentUserId); var workflowRepo = Provider.Get <IWorkflowRepository>(); //new WorkflowRepository(DataContext); WorkflowRepo = workflowRepo; WorkflowEngine = Provider.Get <IWorkflowEngine>(); //new WorkflowEngine(DataContext, workflowRepo, CurrentUserId); ReportGeneratorProvider = Provider.Get <ITemplateReportGeneratorProvider>(); //new TemplateReportGeneratorProvider(DataContext, CurrentUserId); //PdfTempRepo = new PdfTemplateRepository(DataContext, CurrentUserId); //ExcelTempRepo = new ExcelTemplateRepository(DataContext, CurrentUserId); LangRepo = Provider.Get <ILanguageRepository>(); _sqlQueryBuilderFactory = Provider.Get <ISqlQueryBuilderFactory>(); _sqlQueryReaderFactory = Provider.Get <ISqlQueryReaderFactory>(); _comboBoxValueProvider = Provider.Get <IComboBoxEnumProvider>(); _id = RegisterProcess(CurrentUserId, CurrentUserName); }