简体   繁体   English

是否可以使用数据库优先的Entity Framework 6更新SQLite数据库文件?

[英]Is it possible to update a SQLite database file using Entity Framework 6 in database-first?

I'm using SQLite with Entity Framework 6 database-first mode. 我将SQLite与Entity Framework 6数据库优先模式一起使用。

It will be very helpful If there is a way can check the databases file with current .edmx file (auto generated proxy model class) and compare it, if the database is old or there is some table or FX or index missing, then update current SQLite file or add missing table/FX/Index. 如果有一种方法可以用当前的.edmx文件(自动生成的代理模型类)检查数据库文件并将其进行比较,这将非常有帮助,如果数据库旧了或缺少某些表,FX或索引,则可以更新当前文件SQLite文件或添加缺少的表/ FX /索引。

Like: 喜欢:

 using (var ctx = new testDBEntities())
 {
       if (ctx.Database.CheckIfDatabaseIsOld)
       {
          ctx.Database.UpdateCurrentSqliteFileToNew();
       }
 }

No, the sqlite provider does not support code first. 不可以,sqlite提供程序不首先支持代码。 The SQL Server Compact provider does, however 但是,SQL Server Compact提供程序可以

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM