예제 #1
0
        public DbInitializer(WritableDataContext context, IOptions <DbInitializerOptions> options, IClock clock, ILogger <DbInitializer>?logger)
        {
            if (options?.Value == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            _context                 = context ?? throw new ArgumentNullException(nameof(context));
            _clock                   = clock ?? throw new ArgumentNullException(nameof(clock));
            _dbProperties            = _context.GetDbProperties();
            _caseSensitiveComparer   = _dbProperties.CaseSensitiveComparer;
            _caseInsensitiveComparer = _dbProperties.CaseInsensitiveComparer;

            _logger = logger ?? (ILogger)NullLogger.Instance;

            _dbEnsureCreated = options.Value.EnsureCreated;
            _dbSeedObjects   = options.Value.Seed;
        }
예제 #2
0
 private bool ShouldSeedObjects(DbSeedObjects value) => (_dbSeedObjects & value) == value;