Entity Framework 连接MySQL数据库
时间:2021-07-01 10:21:17
帮助过:3人阅读
<?xml version=
"1.0" encoding=
"utf-8"?>
2 <configuration>
3 <configSections>
4 <section name=
"entityFramework" type=
"System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission=
"false" />
5 </configSections>
6
7 <connectionStrings>
8 <add name=
"DefaultConnection" connectionString=
"server=192.168.1.251;User Id=root;password=;Persist Security Info=True;Character Set=utf8;database=yunzhi" providerName=
"MySql.Data.MySqlClient" />
9 </connectionStrings>
10
11 <entityFramework>
12 <defaultConnectionFactory type=
"System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
13 <parameters>
14 <parameter value=
"mssqllocaldb" />
15 </parameters>
16 </defaultConnectionFactory>
17 <providers>
18 <provider invariantName=
"System.Data.SqlClient" type=
"System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
19 <provider invariantName=
"MySql.Data.MySqlClient" type=
"MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
20 </providers>
21 </entityFramework>
22
23 <system.data>
24 <DbProviderFactories>
25 <remove invariant=
"MySql.Data.MySqlClient" />
26 <add name=
"MySQL Data Provider" invariant=
"MySql.Data.MySqlClient" description=
".Net Framework Data Provider for MySQL" type=
"MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
27 </DbProviderFactories>
28 </system.data>
29 </configuration>
Entity Framework 连接MySQL数据库
标签: