如何让Sqlite支持Entity Framework Code-First

从Nuget中获取的sqlite安装包,并不支持EF的code first技术,无法从类定义中生成数据库。

如何办?

方法1:使用第三方库SQLiteCodeFirst( https://github.com/msallin/SQLiteCodeFirst )。注意:需要使用.net framework 4.5

方法2 :使用EF7,其中有内置访问Sqlite的dll。(没试过)

 

如果是开发pc客户端程序,则一般会选择.net framework 3.5,对应的是EF3.5,

只支持基本的O/R映射支持,使用DB First开发模式。

所以sqlite默认没有提供code first支持是有原因的。

 

参考链接

1. Entity Framework 6 with SQLite 3 Code First - Won't create tables 

http://stackoverflow.com/questions/22174212/entity-framework-6-with-sqlite-3-code-first-wont-create-tables

 

2.Entity Framework版本历史概览

http://www.cnblogs.com/fecktty2013/archive/2014/09/26/entityframework-overview.html

 

 

posted on 2015-09-25 16:20  soeasy  阅读(349)  评论(0编辑  收藏  举报

导航