Heim > Datenbank > MySQL-Tutorial > Hauptteil

EntityFramework在不同数据库下的配置

WBOY
Freigeben: 2016-06-07 15:24:12
Original
1168 Leute haben es durchsucht

EntityFramework默认只支持SQLServer数据库,如果想要支持其他数据库,要安装相应的插件。 如支持Oracle,要安装Oracle Data Access Components (ODAC),支持MySQL要安装mysql-connector-net-6.4.6等 下面列举下3种数据库下的配置: 1.SQLServer: connectio

EntityFramework默认只支持SQLServer数据库,如果想要支持其他数据库,要安装相应的插件。

如支持Oracle,要安装Oracle Data Access Components (ODAC),支持MySQL要安装mysql-connector-net-6.4.6等

下面列举下3种数据库下的配置:

1.SQLServer:

<connectionstrings>
    <add name="EntityDesignEntities" connectionstring="metadata=res://*/EntityDataModel.EntityDesign.csdl|res://*/EntityDataModel.EntityDesign.ssdl|res://*/EntityDataModel.EntityDesign.msl;provider=System.Data.SqlClient;provider connection string=" data source=".;initial" catalog="DevBase;persist" security info="True;user" id='sa;password=xxx;multipleactiveresultsets=True;App=EntityFramework""' providername="System.Data.EntityClient"></add>
  </connectionstrings>
Nach dem Login kopieren


 

2.Oracle:

<connectionstrings>
    <add name="EntityDesignEntities" connectionstring="metadata=res://*/EntityDataModel.EntityDesign.csdl|res://*/EntityDataModel.EntityDesign.ssdl|res://*/EntityDataModel.EntityDesign.msl;provider=Oracle.DataAccess.Client;provider connection string=" data source="xe;password=xxx;persist" security info="True;user" id='sa""' providername="System.Data.EntityClient"></add>
  </connectionstrings>
Nach dem Login kopieren


 

3.MySQL:

<connectionstrings>
    <add name="EntityDesignEntities" connectionstring="metadata=res://*/EntityDataModel.EntityDesign.csdl|res://*/EntityDataModel.EntityDesign.ssdl|res://*/EntityDataModel.EntityDesign.msl;provider=MySql.Data.MySqlClient;provider connection string=" server="localhost;user" id="sa;password=xxxx;persist" security info='True;database=world""' providername="System.Data.EntityClient"></add>
  </connectionstrings>
Nach dem Login kopieren


 

Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!