EntityFramework在不同数据库下的配置

时间:2023-09-28 10:18:50

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" />
</connectionStrings>

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"/>
</connectionStrings>

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"/>
</connectionStrings>