public ILogMaintainer Create(string connectionString, PHmiModel.Entities.Log log, ITimeService timeService) { var npgsqlConnectionFactory = new NpgsqlConnectionFactory(connectionString); var logRepository = new LogRepository(log.Id); using (var connection = npgsqlConnectionFactory.Create()) { logRepository.EnsureTable(connection); } return new LogMaintainer( log, logRepository, timeService, npgsqlConnectionFactory); }
public IAlarmsRunTarget Create(string connectionString, IProject project, alarm_categories alarmCategory, ITimeService timeService) { var npgsqlConnectionFactory = new NpgsqlConnectionFactory(connectionString); var alarmsRepository = new AlarmsRepository(alarmCategory.id); using (var connection = npgsqlConnectionFactory.Create()) { alarmsRepository.EnsureTable(connection); } return new AlarmsRunTarget( alarmCategory, new NotificationReporter(timeService) {LifeTime = TimeSpan.FromTicks(0)}, alarmsRepository, project, timeService, npgsqlConnectionFactory); }
public ITrendsRunTarget Create(string connectionString, IProject project, trend_categories trendCategory, ITimeService timeService) { var npgsqlConnectionFactory = new NpgsqlConnectionFactory(connectionString); var repositoryFactory = new TrendsRepositoryFactory( npgsqlConnectionFactory, trendCategory.id, trendCategory.trend_tags.Select(t => t.id).ToArray()); using (var repository = repositoryFactory.Create()) { repository.EnsureTables(); } return new TrendsRunTarget( trendCategory, new NotificationReporter(timeService) { LifeTime = TimeSpan.FromTicks(0) }, repositoryFactory, project, timeService, new TrendTableSelector()); }