Using the SQLite database summary in your project

Source: Internet
Author: User
Tags sqlite sqlite database sqlite query

------------------------------------------------------------------------
Recommended:
-VS2012 using the 1.0.84 version of the library
-VS2013 using the 1.0.93 version of the library
------------------------------------------------------------------------
1. Install the runtime Library
Sqlite-netfx45-setup-bundle-x64-2012-1.0.84.0.exe
Sqlite-netfx45-setup-bundle-x86-2012-1.0.84.0.exe (the latest test, 64-bit system, just install this on the line)
Optional installation to the GAC, integrated into the VS2012 (or VS2013)

2, create the project, VS2012 project. NET version Select the. NET version of the 4.5,VS2013 project 4.5.1

3. Install NuGet

1 install-package entityframework-version 5.02 install-package system.data.sqlite-version 1.0.84

(Latest test, 64-bit system, this step is not required)

4. Modify App.config/web.config (without prompting: The specified store provider could not be found in the configuration)

(The latest test, these do not add, the supernatural)

<System.Data><dbproviderfactories><Removeinvariant= "System.Data.SQLite"/><Addname= "SQLite Data Provider"invariant= "System.Data.SQLite"Description= ". Net Framework Data Provider for SQLite"type= "System.Data.SQLite.SQLiteFactory, System.Data.SQLite, version=1.0.84.0, Culture=neutral, publickeytoken= db937bc2d44ff139 " /></dbproviderfactories></System.Data>

5. Add edmx normally to manipulate the SQLite database in your project.

========================================
The latest test, many of the above steps do not need:
========================================
1, as long as the installation of X86 run library (VS2012 with 1.0.84.0,vs2013 1.0.93.0)
2. Create a ClassLibrary Models project library
3. You can add an edmx in the project library (T4 or default template is fine)
4. MVC3/4 Project and console project, direct reference to models project library
5. MVC Project Modify Web.config,console project Modify App. Config to add a connection string
6. MVC Project Modification Views\web.config Add a namespace reference to the Models project library
7. You can then access the SQLite database normally in the project.
Note: The edmx of the T4 template (which generates the standalone Poco class) can be used directly, and the edmx of the default template (all classes generated in Designer.cs) needs to modify the Web. config in the referenced project:

<compilationDebug= "true"targetframework= "4.0"> <!--It may also be 4.5,vs2013 is 4.5.1, according to the project needs -<Assemblies><AddAssembly= "System.Data.Entity, version=4.0.0.0, Culture=neutral, publickeytoken=b77a5c561934e089" /></Assemblies></compilation>

==============================================

Note: SQLite query error IndexOutOfRange, is missing field, or field name is wrong.

P.s wrote a small test project and put it in the Tokyo code base.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.