public async void Constructed_update_statement_uses_default_commandTimeout_can_override_configured_in_context_async() { var serviceProvider = new ServiceCollection() .AddEntityFramework() .AddSqlServer() .ServiceCollection() .AddSingleton <IModificationCommandBatchFactory, TestSqlServerModificationCommandBatchFactory>() .BuildServiceProvider(); using (var context = new ConfiguredChipsContext(serviceProvider)) { context.Database.EnsureCreated(); context.Chips.Add(new KettleChips { BestBuyDate = DateTime.Now, Name = "Doritos Locos Tacos" }); await context.SaveChangesAsync(); Assert.Equal(77, GlobalCommandTimeout); context.Database.SetCommandTimeout(88); context.Chips.Add(new KettleChips { BestBuyDate = DateTime.Now, Name = "Doritos Locos Tacos" }); await context.SaveChangesAsync(); Assert.Equal(88, GlobalCommandTimeout); } }
public async void Overridden_commandTimeout_overrides_timeout_configured_in_context_async() { var serviceProvider = new ServiceCollection() .AddEntityFramework() .AddSqlServer() .ServiceCollection .AddSingleton <SqlServerModificationCommandBatchFactory, TestSqlServerModificationCommandBatchFactory>() .BuildServiceProvider(); using (var context = new ConfiguredChipsContext(serviceProvider, "KettleChips")) { context.Database.EnsureCreated(); context.Database.AsRelational().Connection.CommandTimeout = 88; await context.Chips.AddAsync(new KettleChips { BestBuyDate = DateTime.Now, Name = "Doritos Locos Tacos" }); await context.SaveChangesAsync(); Assert.Equal(88, globalCommandTimeout); } }
public async void Overridden_commandTimeout_overrides_timeout_configured_in_context_async() { var serviceProvider = new ServiceCollection() .AddEntityFramework() .AddSqlServer() .ServiceCollection() .AddSingleton<SqlServerModificationCommandBatchFactory, TestSqlServerModificationCommandBatchFactory>() .BuildServiceProvider(); using (var context = new ConfiguredChipsContext(serviceProvider, "KettleChips")) { context.Database.EnsureCreated(); context.Database.AsRelational().Connection.CommandTimeout = 88; context.Chips.Add(new KettleChips { BestBuyDate = DateTime.Now, Name = "Doritos Locos Tacos" }); await context.SaveChangesAsync(); Assert.Equal(88, globalCommandTimeout); } }