简体   繁体   English

使用 EF context.Database.EnsureCreated 创建 SQLite 虚拟表?

[英]Creating SQLite Virtual Table with EF context.Database.EnsureCreated?

Would be possible to create SQLite Virtual Table using EF Core context.Database.EnsureCreated() ?是否可以使用 EF Core context.Database.EnsureCreated()创建 SQLite 虚拟表? I would expect something like [Virtual] attribute to the respective model class.我希望各个 model class 的[Virtual]属性类似。

The reason for this question is using free text search (FTS) for SQLite in-memory DB which requires virtual table.这个问题的原因是对需要虚拟表的 SQLite 内存 DB 使用自由文本搜索 (FTS)。 I understand that I can use runtime migrations but EnsureCreated() is so neat and convenient.我知道我可以使用运行时迁移,但 EnsureCreated() 非常简洁方便。

It seems to be not possible using context.Database.EnsureCreated() directly for such specifics but a runtime migration works just fine.似乎不可能直接使用context.Database.EnsureCreated()来处理这些细节,但运行时迁移工作得很好。 I only had to replace this line with very similar context.Database.Migrate() (having migration already in the project, of course) and that's it.我只需要用非常相似的context.Database.Migrate()替换这一行(当然,在项目中已经有了迁移),就是这样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 context.Database.EnsureDeleted() 和 context.Database.EnsureCreated() 失败 - context.Database.EnsureDeleted() and context.Database.EnsureCreated() fails EF Core Database.EnsureCreated 获取创建表 SQL 并且不向数据库发送请求 - EF Core Database.EnsureCreated get creating table SQL and without sending request to database EF未为虚拟属性创建表 - EF not creating table for virtual properties EF Core 2.1中的DbContext.Database.EnsureCreate令人困惑的行为 - Confusing Behavior of DbContext.Database.EnsureCreated in EF Core 2.1 Database.EnsureCreated无法正常工作 - Database.EnsureCreated not working 如何在Database.EnsureCreated()和EF Xamarin.Forms之后使用Database.Migration() - How to use Database.Migration() after Database.EnsureCreated() EF Xamarin.Forms Database.EnsureCreated EF 7 ASP.NET 5 MVC 6处的堆栈溢出异常 - Stack Overflow exception at Database.EnsureCreated EF 7 ASP.NET 5 MVC 6 创建ThreadLocal EF上下文 - Creating a ThreadLocal EF context Database.EnsureCreated似乎不是在创建数据库(xamarin.forms) - Database.EnsureCreated does not seem that it's creating a database (xamarin.forms) 使用EF映射SQLite数据库 - Map SQLite database with EF
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM