public LogEngine() { JsonConfigReader configReader = new JsonConfigReader(JsonConfigReader.ConfigFileName); Require.NotNull(configReader, nameof(configReader)); Console.WriteLine("data reading from config file"); var connectionString = configReader.GetConnectionString("ApacheLogs"); _filePath = configReader.GetValue <string>("FilePath"); _accessKey = configReader.GetValue <string>("AccessKey"); _counterForSave = configReader.GetValue <int>("CounterForSave"); _outerIpServiceUrl = configReader.GetValue <string>("OuterIpServiceUrl"); _httpClient = new InnerHttpClient(); Require.NotEmpty(connectionString, () => $"{connectionString} should be specified in the appsettings.json file"); Require.NotNull(_httpClient, nameof(_httpClient)); Require.NotEmpty(_filePath, "'FilePath' should be specified in the appsettings.json file"); Require.NotEmpty(_accessKey, "'AccessKey' should be specified in the appsettings.json file"); Require.NotEmpty(_outerIpServiceUrl, "'OuterIpServiceUrl' should be specified in the appsettings.json file"); Require.IsTrue(_counterForSave > 0, "'CounterForSave' should be specified in the appsettings.json file"); Console.WriteLine("data base connecting"); var optionsBuilder = new DbContextOptionsBuilder <ApacheLogDbContext>(); optionsBuilder.UseSqlServer(connectionString); DbContextOptions <ApacheLogDbContext> options = optionsBuilder.Options; _context = new ApacheLogDbContext(options); Require.NotNull(_context, nameof(_context)); _context.Initialize(); }
public HostService(ApacheLogDbContext context) : base(context) { }
public RouteService(ApacheLogDbContext context) : base(context) { }
public LogsService(ApacheLogDbContext context, IMapper mapper) : base(context) { Require.NotNull(mapper, () => nameof(mapper)); _mapper = mapper; }
public BaseService(ApacheLogDbContext context) { Require.NotNull(context, () => nameof(context)); _context = context; }