예제 #1
0
 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);
 }
예제 #2
0
        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));
        }