entity framework - How use EF on SqlConnection object -
i have old winforms project uses localdb , ado.net sqlconnection. have created new database (not local), use entity framework connect to. when use new ef-database on sqlconnection error says sqlconnection not support metadata new connectionstring.
is correct sqlconnection needs localdb? how can sqlconnection can connect new database?
//martin
an entity framework connection string contains meta data element points location of entity framework model:
<connectionstrings> <add name="adventureworksentities" connectionstring="metadata=.\adventureworks.csdl|.\adventureworks.ssdl|.\adventureworks.msl; provider=system.data.sqlclient;provider connection string='data source=localhost; initial catalog=adventureworks;integrated security=true;connection timeout=60; multipleactiveresultsets=true'" providername="system.data.entityclient" /> </connectionstrings> a sql connection string looks this:
server=myserveraddress;database=mydatabase;trusted_connection=true; if application uses sqlconnection must connect database connection string has structure of sqlconnection string.
Comments
Post a Comment