SQL Server compact Entity Framework usage notes SQL Server compact DLL file Introduction

Source: Internet
Author: User
Tags sql studio connectionstrings

Development Environment

1. vs2010sp1

2. Microsoft SQL Server compact 4.0

3. Visual Studio 2010 SP1 tools for SQL Server compact 4.0 came out only after SQL Server compact 4.0 was vs10.

 

Create an SQL Server compact database

1. Use SQL Studio

The database file drop-down box displays the options for creating a compact database.

2. vs Studio

Vs new project added new data compact 4.0 database items

 

How to upgrade SQL compact 3.5 to SQL compact4.0

Use the upgrade () method

VaR filename = @ "G: \ XXX. SDF ";
VaR SSC = new system. Data. sqlserverce. sqlceengine ("Data Source =" + filename );
SSC. Upgrade ();

You must reference system. Data. sqlserverce. dll in the private folder of the installation path of SQL compact4.0.

 

Connect Entity Framework to SQL compact4.0

Entity Framework 4.0 or later is required

Connection string

<Connectionstrings>
<Add name = "XXX" connectionstring = "Data Source = data/xxx. SDF; persist Security info = false;" providername = "system. Data. sqlserverce.4.0"/>
</Connectionstrings>

Add provider Configuration

<System. Data>
<Dbproviderfactories>
<Remove invariant = "system. Data. sqlserverce.4.0"/>
<Add name = "Microsoft SQL Server compact data provider 4.0" invariant = "system. data. sqlserverce.4.0 "Description = ". NET framework data provider for Microsoft SQL Server compact "type =" system. data. sqlserverce. sqlceproviderfactory, system. data. sqlserverce, version = 4.0.0.0, culture = neutral, publickeytoken = 89845dcd8080cc91 "/>
</Dbproviderfactories>
</System. Data>

If you encounter some errors when you are not familiar with SQL compact deployment, refer to Uncle Qum's Microsoft ASP. NET site deployment guide (12): troubleshooting article

The correct configuration of SQL compact is as follows:

Copy the following files to the bin directory.

1. system. Data. sqlserverce. dll and system. Data. sqlserverce. dll under the desktop directory in v4.0

2. In v4.0, all files under x86 in the private directory or all files under amd64 correspond to 32-bit systems. amd64 corresponds to 64-bit systems.

 

Database provider accessed by system. Data. sqlserverce. dll. NET Compact framework. System. Data. sqlserverce. entity. dll supports ADO. NET Entity Framework.

For other DLL meanings, refer to the DLL file introduction of SQL Server compact.

 

 

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.