public void Configure(
     DbContextOptionsBuilder optionsBuilder,
     DbContextSettings dbContextSettings)
 {
     optionsBuilder
     .UseInMemoryDatabase(dbContextSettings.SchemaName);
 }
 internal DesignTimeDbContextFactory(
     DbContextSettings dbContextSettings,
     IDbContextOptionsConfigurator dbContextOptionsConfigurator)
 {
     _dbContextSettings            = dbContextSettings;
     _dbContextOptionsConfigurator = dbContextOptionsConfigurator;
 }
 public void Configure(
     DbContextOptionsBuilder optionsBuilder,
     DbContextSettings dbContextSettings)
 {
     optionsBuilder.UseNpgsql(dbContextSettings.ConnectionString, options =>
     {
         options
         .MigrationsHistoryTable(HistoryRepository.DefaultTableName, dbContextSettings.SchemaName)
         .CommandTimeout(dbContextSettings.CommandTimeout);
         if (dbContextSettings.MigrationsAssemblyName != null)
         {
             options.MigrationsAssembly(dbContextSettings.MigrationsAssemblyName);
         }
     });
 }
        internal DbContextProvider(
            Type dbContextType,
            DbContextSettings dbContextSettings,
            IDbContextOptionsConfigurator dbContextOptionsConfigurator)
        {
            if (dbContextType == null)
            {
                throw new ArgumentNullException(nameof(dbContextType));
            }

            if (!dbContextType.IsSubclassOf(typeof(EfDbContext)))
            {
                throw new ArgumentException($"Should be inherited from {nameof(EfDbContext)}.", nameof(dbContextType));
            }

            _dbContextType                = dbContextType;
            _dbContextSettings            = dbContextSettings ?? throw new ArgumentNullException(nameof(dbContextSettings));
            _dbContextOptionsConfigurator = dbContextOptionsConfigurator ?? throw new ArgumentNullException(nameof(dbContextOptionsConfigurator));
        }
Esempio n. 5
0
 public void Configure(
     DbContextOptionsBuilder optionsBuilder,
     DbContextSettings dbContextSettings)
 {
     optionsBuilder.UseSqlServer(dbContextSettings.ConnectionString, options =>
     {
         options
         .MigrationsHistoryTable(HistoryRepository.DefaultTableName, dbContextSettings.SchemaName)
         .CommandTimeout(dbContextSettings.CommandTimeout);
         if (dbContextSettings.RetriesCount > 0)
         {
             options.EnableRetryOnFailure(dbContextSettings.RetriesCount);
         }
         if (dbContextSettings.MigrationsAssemblyName != null)
         {
             options.MigrationsAssembly(dbContextSettings.MigrationsAssemblyName);
         }
     });
 }