Entityconnection connectionstring (different models use the same connection string)

Source: Internet
Author: User
Tags dnn

Original post on: http://blog.csdn.net/firefox1/archive/2009/07/12/4342245.aspx

 

Recently, the Entity Framework under ado.net 3.5 was used in dnn development. I did not expect to be dizzy by its connection string. I found some information on the Internet and learned more about it. Now I want to share with you.

The connection string of entity connection must contain four pieces of information.

CSDL
SSDL
MSL
Database connection information.
The following information is displayed in the connection string:

Metadata = Res: // */model. CSDL | res: // */model. SSDL | res: // */model. MSL; provider = system. data. sqlclient; provider connection string = 'data source =. /sql2005; initial catalog = databasename; user id = dnn; Password = dnn'

Does it seem troublesome? To make it simple, you must first understand its meaning.

The following uses Res: // */model. CSDL as an example to find the resources named model. CSDL in all the assemblies in the current directory. You can use the. NET Resource ing tool to view the information.

Res: // model. CSDL. It means to find the model. CSDL resource in assebmly of assemblyname.

Res: //. It means to find CSDL, SSDL, and MSL resources in assemblyname assembly.

Res: // */. It indicates that CSDL, SSDL, and MSL resources are found in all the assemblies in the current directory.

After figuring out the above, the connection string can be simplified

Metadata = Res: // */; provider = system. data. sqlclient; provider connection string = 'data source =. /sql2005; initial catalog = databasename; user id = dnn; Password = dnn'

It's much simpler.

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/firefox1/archive/2009/07/12/4342245.aspx

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.