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