Esempio n. 1
0
        /// <summary>
        /// Initialize <see cref="Seeder"/>
        /// </summary>
        /// <param name="options">The database context options</param>
        public Seeder(ICurrentDbContext currentDbContext, ISeedRepository seedRepository, ISeedAssembly seedAssembly, ILoggerFactory loggerFactory, IDbContextOptions dbContextOptions)
        {
            var seedOptions = (SeedOptionsExtension)dbContextOptions.Extensions.Where(o => o.GetType().IsSubclassOf(typeof(SeedOptionsExtension))).FirstOrDefault();

            SeedConfiguration = seedOptions.SeedConfiguration;

            _logger           = loggerFactory.CreateLogger <Seeder>();
            _currentDbContext = currentDbContext;
            _seedRepository   = seedRepository;
            _seedAssembly     = seedAssembly;
        }
 /// <summary>
 /// Initialize a relational seeder
 /// </summary>
 /// <param name="currentDbContext">The current db context</param>
 /// <param name="seedRepository">The seed repository</param>
 /// <param name="seedAssembly">The seed assembly</param>
 /// <param name="seedDependencies">The relational seed dependencies</param>
 public RelationalSeeder(ICurrentDbContext currentDbContext, ISeedRepository seedRepository, ISeedAssembly seedAssembly, ILoggerFactory loggerFactory, HistoryRepositoryDependencies seedDependencies) : base(currentDbContext, seedRepository, seedAssembly, loggerFactory, seedDependencies.Options)
 {
     _seedDependencies = seedDependencies;
 }