To EF6 Code First mode support SQLite has a few steps:
One, need to install Sqlite-netfx451-setup-bundle-x86-2013-1.0.92.0.exe to let vs add ado with SQLite optional
1) go to Http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki to download the corresponding. NET version of the installation file (* Note the download file name with bundle, This will do plug-in support for VS )
2) Installation
To select all installations
Tick the two check boxes below to support vs
Then the next step ...
This interface will stay for a long time, but do not care about it, not to manually close it, this is registered vs plug-in
When you see this, you can turn on vs for SQLite add
3) Vs Add entity model
You'll see this, and then you can have fun with SQLite.
Second, EF6 support
Once the first step is complete, the program can use EF's code frist, but at the same time, there is a problem, that is, the program is running on other computers can not find System.Data.Sqlite program support, unless the first step to repeat.
The System.Data.Sqlite package in Nuget solves this problem.
1) Installing the NuGet package
Find SQLite online in the NuGet admin interface, add the first one, and add three more.
You can also enter commands in the NuGet console: Install-package System.Data.Sqlite
2) Modify Config
The red line is to be added manually, the code is as follows
<entityFramework>
<defaultconnectionfactory type= "System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
<providers>
<provider invariantname= "System.Data.SqlClient" type= "System.Data.Entity.SqlServer.SqlProviderServices, Entityframework.sqlserver "/>
<provider invariantname= "System.Data.SQLite" type= "System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6 "/>
<provider invariantname= "System.Data.SQLite.EF6" type= "System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6 "/>
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant= "System.Data.SQLite"/>
<add name= "SQLite data Provider" invariant= "System.Data.SQLite" description= ". NET Framework Data Provider for SQLite "Type=" System.Data.SQLite.SQLiteFactory, System.Data.SQLite "/>
<remove invariant= "System.Data.SQLite.EF6"/>
<add name= "SQLite Data Provider (Entity Framework 6)" invariant= "System.Data.SQLite.EF6" description= ". NET Framework Data Provider for SQLite (Entity Framework 6) "Type=" System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6 "/>
</DbProviderFactories>
</system.data>
PS: When adding Sqlite to a solid model, only the 5.0 framework is optional, which means that EF5 is added first, so uninstall EF5 before adding the System.Data.Sqlite package
At this point, you can use the EF6 to manipulate the SQLite database at vs.
EF6 Code first perfectly supports SQLite