首页 > 代码库 > EF MySql 配置文件

EF MySql 配置文件

 1   <?xml version="1.0" encoding="utf-8"?><!--有关如何配置 ASP.NET 应用程序的详细信息,请访问
 2   http://go.microsoft.com/fwlink/?LinkId=169433
 3   -->
 4 <configuration>
 5   <configSections>
 6     <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
 7     <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
 8   </configSections>
 9   <system.web>
10     <compilation debug="true" targetFramework="4.5" />
11     <httpRuntime targetFramework="4.5" />
12   </system.web>
13   <system.data>
14 
15      <DbProviderFactories>
16        <!-- 不设置这里会提示找不到提供程序-->
17       <add name="MySQL" description="ADO.Net driver for MySQL" invariant="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data"/>
18     </DbProviderFactories>
19   </system.data>
20   <entityFramework>
21      <!-- 默认设置的sql-->
22     <defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6">
23       <parameters>
24         <parameter value=http://www.mamicode.com/"v11.0" />
25       </parameters>
26     </defaultConnectionFactory>
27     <providers>
28       <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6"  />
29     </providers>
30   </entityFramework>
31   <connectionStrings>
32     <add name="mysqlConn" connectionString="DataSource=localhost;DataBase=mysql;uid=root;pwd=410115424" providerName="MySql.Data.MySqlClient" />
33   </connectionStrings>
34 </configuration>