示例#1
0
            public override SqlServerTestStore CreateTestStore()
            {
                return(SqlServerTestStore.GetOrCreateShared(DatabaseName, () =>
                {
                    var optionsBuilder = new DbContextOptionsBuilder();
                    optionsBuilder.UseSqlServer(SqlServerTestStore.CreateConnectionString(DatabaseName));

                    using (var context = new StoreGeneratedContext(_serviceProvider, optionsBuilder.Options))
                    {
                        context.Database.EnsureDeleted();
                        context.Database.EnsureCreated();
                    }
                }));
            }
示例#2
0
            public SqlServerNullKeysFixture()
            {
                _serviceProvider = new ServiceCollection()
                                   .AddEntityFramework()
                                   .AddSqlServer()
                                   .ServiceCollection
                                   .AddTestModelSource(OnModelCreating)
                                   .BuildServiceProvider();

                _options = new DbContextOptions();
                _options.UseSqlServer(SqlServerTestStore.CreateConnectionString("StringsContext"));

                EnsureCreated();
            }
示例#3
0
            public NullKeysSqlServerFixture()
            {
                _serviceProvider = new ServiceCollection()
                                   .AddEntityFramework()
                                   .AddSqlServer()
                                   .ServiceCollection()
                                   .AddSingleton(TestSqlServerModelSource.GetFactory(OnModelCreating))
                                   .BuildServiceProvider();

                var optionsBuilder = new DbContextOptionsBuilder();

                optionsBuilder.UseSqlServer(SqlServerTestStore.CreateConnectionString("StringsContext"));
                _options = optionsBuilder.Options;

                EnsureCreated();
            }
示例#4
0
            public override SqlServerTestStore CreateTestStore()
            {
                return(SqlServerTestStore.GetOrCreateShared(DatabaseName, () =>
                {
                    var optionsBuilder = new EntityOptionsBuilder();
                    optionsBuilder.UseSqlServer(SqlServerTestStore.CreateConnectionString(DatabaseName));

                    using (var context = new GraphUpdatesContext(_serviceProvider, optionsBuilder.Options))
                    {
                        context.Database.EnsureDeleted();
                        if (context.Database.EnsureCreated())
                        {
                            Seed(context);
                        }
                    }
                }));
            }
示例#5
0
 protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
 {
     optionsBuilder.UseSqlServer(SqlServerTestStore.CreateConnectionString(_databaseName));
 }
示例#6
0
 protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
 => optionsBuilder.UseSqlServer(SqlServerTestStore.CreateConnectionString("Repro963"));
示例#7
0
 protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
 => optionsBuilder
 .EnableSensitiveDataLogging()
 .UseSqlServer(SqlServerTestStore.CreateConnectionString("Repro925"));
示例#8
0
 protected override void OnConfiguring(DbContextOptions options)
 {
     options.UseSqlServer(SqlServerTestStore.CreateConnectionString("Repro603"));
 }
示例#9
0
 protected override void OnConfiguring(EntityOptionsBuilder optionsBuilder)
 {
     optionsBuilder.UseSqlServer(SqlServerTestStore.CreateConnectionString("Repro963"));
 }
示例#10
0
            protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
            {
                var name = GetType().FullName.Substring((GetType().Namespace + nameof(SqlServerValueGenerationScenariosTest)).Length + 2);

                optionsBuilder.UseSqlServer(SqlServerTestStore.CreateConnectionString(name));
            }
示例#11
0
 protected override void OnConfiguring(DbContextOptions options)
 {
     options.UseSqlServer(SqlServerTestStore.CreateConnectionString(_databaseName));
     base.OnConfiguring(options);
 }