[英]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.