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, AlarmCategory 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)); }