当我运行多个测试时,以前测试中的数据仍然保留在数据库中。如何处理现有内存数据库?Services.AddScoped<DbContextOptions<MyDbContext>>(sp => new DbContextOptionsBuilder<TacsDbContext>() {
using (var dbContext = ServiceProvider.GetService<MyDbContext>())
我正在使用EF Core2.0.0和InMemory 2.0.0创建xunit测试。我注意到没有在上下文中添加实体。MyDbContext InitContext() var options = new DbContextOptionsBuilder<MyDbContext>()
.UseInMemoryDatabase如何将实体添加到Appointment集合而不是Appointment.Local集合?