/// <summary> /// Инициализация хранилища /// </summary> static void init() { //события DataSourceEvents dses = repository.CreateOrLoadMetaObject(MetaObjectType.DataSourceEvents, "DataSourceEvents") as DataSourceEvents; repository.Save(dses); //ETL ETL etl = repository.CreateOrLoadMetaObject(MetaObjectType.ETL, "etl1") as ETL; etl.AssemblyPath = Directory.GetCurrentDirectory() + "\\ETL.exe"; etl.AssemblyArgs = connectionString; repository.Save(etl); //ETLs ETLs etls = repository.CreateOrLoadMetaObject(MetaObjectType.ETLs, "ETLs") as ETLs; etls.AddETL(etl); repository.Save(etls); //источник данных DataSource ds = repository.CreateOrLoadMetaObject(MetaObjectType.DataSource, "ds1") as DataSource; ds.DataSourceName = "Росстат. Население."; ds.DataSourceType = "type"; ds.Url = "url"; ds.SetETL(etl); repository.Save(ds); //создаем расписание и задание ReglamentMetaObject rmo = repository.CreateOrLoadMetaObject(MetaObjectType.Reglament, "Reglament") as ReglamentMetaObject; ReglamentElementMetaObject remo = repository.CreateOrLoadMetaObject(MetaObjectType.ReglamentElement, "ReglamentElement" + Guid.NewGuid().ToString()) as ReglamentElementMetaObject; rmo.AddReglamentElement(remo); remo.Enabled = true; remo.ReglamentElementType = "ExecETL"; remo.NextRunTime = DateTime.Parse("18:37 17.6.2012"); remo.Period = TimeSpan.FromMinutes(5); remo.SetDataSource(ds); repository.Save(remo); repository.Save(rmo); //задание проверки источника remo = repository.CreateOrLoadMetaObject(MetaObjectType.ReglamentElement, "ReglamentElement" + Guid.NewGuid().ToString()) as ReglamentElementMetaObject; remo.Enabled = true; remo.ReglamentElementType = "CheckDS"; remo.NextRunTime = DateTime.Parse("00:59 19.6.2012"); remo.Period = TimeSpan.FromMinutes(3); remo.SetDataSource(ds); repository.Save(remo); rmo.AddReglamentElement(remo); repository.Save(rmo); }
/// <summary> Constructs a new EntityApp instance. </summary> public EntityApp(string appName = null, string version = "1.0.0.0", string activationLogPath = null) { _shutdownTokenSource = new CancellationTokenSource(); AppName = appName ?? this.GetType().Name; Version = new Version(version); Status = EntityAppStatus.Created; AppEvents = new EntityAppEvents(this); DataSourceEvents = new DataSourceEvents(this); AppDomain.CurrentDomain.DomainUnload += CurrentDomain_DomainUnload; // Time service and Timers service are global singletons, we register these here, as early as possible this.TimeService = Vita.Entities.Services.Implementations.TimeService.Instance; this.RegisterService <ITimeService>(this.TimeService); var timers = new TimerService(); this.RegisterService <ITimerService>(timers); this.RegisterService <ITimerServiceControl>(timers); // Logging services this.LogService = new LogService(); RegisterService <ILogService>(LogService); this.LogService.Subscribe(OnLogEntryWritten); var logBatchingService = new LogBatchingService(); RegisterService <ILogBatchingService>(logBatchingService); logBatchingService.Subscribe(OnLogBatchProduced); ActivationLog = new BufferedLog(LogContext.SystemLogContext, 10000, LogService); //Misc services var custService = new EntityModelCustomizationService(this); this.RegisterService <IEntityModelCustomizationService>(custService); this.DataAccess = new DataAccessService(this); RegisterService <IDataAccessService>(this.DataAccess); RegisterService <IBackgroundTaskService>(new DefaultBackgroundTaskService()); RegisterService <IHashingService>(new HashingService()); }
/// <summary> Constructs a new EntityApp instance. </summary> public EntityApp(string appName = null, string version = "1.0.0.0", string activationLogPath = null) { _services = new Dictionary <Type, object>(); _shutdownTokenSource = new CancellationTokenSource(); AppName = appName ?? this.GetType().Name; Version = new Version(version); Status = EntityAppStatus.Created; AppEvents = new EntityAppEvents(this); DataSourceEvents = new DataSourceEvents(this); AppDomain.CurrentDomain.DomainUnload += CurrentDomain_DomainUnload; // Time service and Timers service are global singletons, we register these here, as early as possible this.TimeService = this.RegisterService <ITimeService>(Vita.Entities.Services.Implementations.TimeService.Instance); var timers = this.RegisterService <ITimerService>(new TimerService()); this.RegisterService <ITimerServiceControl>(timers as ITimerServiceControl); this.RegisterService <ILogService>(new DefaultLogService()); var custService = new EntityModelCustomizationService(this); this.RegisterService <IEntityModelCustomizationService>(custService); this.DataAccess = RegisterService <IDataAccessService>(new DataAccessService(this)); RegisterService <IBackgroundTaskService>(new DefaultBackgroundTaskService()); RegisterService <IHashingService>(new HashingService()); ActivationLog = new ActivationLog(activationLogPath, app: this); }