예제 #1
0
        public CoreLogger(IOptions <CoreLoggerConfiguration> configuration)
        {
            _configuration = configuration.Value ?? throw new ArgumentNullException("Configurations cannot be null");

            if (!string.IsNullOrWhiteSpace(_configuration.SQL_ConnectionString))
            {
                using (var ctx = new ContextSQL(_configuration.SQL_ConnectionString))
                {
                    ctx.Database.Migrate();
                }
            }
        }
예제 #2
0
 public InspectorService(
     IWebHostEnvironment environment,
     IMemoryCache cache,
     ICoreLogger logger)
 {
     _environment = environment ?? throw new ArgumentNullException($"Injection fail for {nameof(IWebHostEnvironment)} in CoreLogger.Inspector");
     _cache       = cache ?? throw new ArgumentNullException($"Injection fail for {nameof(IMemoryCache)} in CoreLogger.Inspector");
     _logger      = logger ?? throw new ArgumentNullException($"Injection fail for {nameof(ICoreLogger)} in CoreLogger.Inspector");
     _options     = _logger.Configuration;
     _credentials = _logger
                    .Configuration
                    .Environments
                    ?.Where(t => !t.DenyEnvironmet && t.EnvironmentName == _environment.EnvironmentName)
                    ?.FirstOrDefault()
                    ?.UseAuthentication;
 }