/// <summary> Constructs a new EntityApp instance. </summary> public EntityApp(string appName = null, string version = "1.0.0.0") { AppName = appName ?? this.GetType().Name; Version = new Version(version); SystemLog = new SystemLog(); Status = EntityAppStatus.Created; AppEvents = new EntityAppEvents(this); EntityEvents = new EntityEvents(); AttributeHandlers = CustomAttributeHandler.GetDefaultHandlers(); SizeTable = Sizes.GetDefaultSizes(); 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>(Services.Implementations.TimeService.Instance); var timers = this.RegisterService <ITimerService>(new TimerService()); this.RegisterService <ITimerServiceControl>(timers as ITimerServiceControl); }
/// <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); }