EF核心SqLite内存中没有这样的表?
我使用UseInMemoryDatabase()配置了我的ASP.NET Core 2.2应用程序,效果很好。现在我在内存中将其更改为关系Sqlite Startup.csEF核心SqLite内存中没有这样的表?,sqlite,asp.net-core,entity-framework-core,in-memory-database,Sqlite,Asp.net Core,Entity Framework Core,In Memory Database,我使用UseInMemoryDatabase()配置了我的ASP.NET Core 2.2应用程序,效果很好。现在我在内存中将其更改为关系Sqlite Startup.cs services.AddDbContext<ApplicationContext>(options => options.UseSqlite("Datasource=file::memory:?cache=shared")); services.AddDbContext创建并将迁移应用到内存中的SQLi
services.AddDbContext<ApplicationContext>(options => options.UseSqlite("Datasource=file::memory:?cache=shared"));
services.AddDbContext创建并将迁移应用到内存中的SQLite数据库。每次应用程序启动时,您都必须应用它们,因为在应用程序退出之前,数据库只存在于内存中。在ConfigureServices()中的Startup.cs中,我打开了与数据库的连接。在Configure()中,我获取上下文并运行context.Database.Migrate()。仍然是同一个错误,但当我使用context.Database.EnsureCreated()时,它启动时没有错误。因此,迁移不起作用,只需创建db模式即可。