1 <xmlのバージョン=?" 1.0 "エンコード= " UTF-8 "?> 2 <! - 3 訪れ、ASP.NETアプリケーションを構成する方法の詳細については 4 HTTPSを:// go.microsoft.com/fwlink ?/ = 301880がLinkId 5 - > 6 <構成> 7 <configSections> 8 <セクション名= " EntityFramework "タイプ=の" System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection、EntityFramework、バージョン= 6.0.0.0、文化=中立、なPublicKeyToken = b77a5c561934e089 "requirePermission = "偽" /> 9 < - Entity Frameworkの構成の詳細については、訪問のhttp:// go.microsoft.com/fwlink/?LinkID=237468 - > 10 </ configSections> 11 <のconnectionStrings> 12 <追加名前= " のDataModel " providerNameで= " MySql.Data.MySqlClient "たconnectionString = " データソース= localhostの;初期カタログ=デモ;ユーザーID =ルート;パスワード= 123456 " /> 13 < - <=名前を追加します!" のDataModelは"のConnectionString = "データソース=;初期カタログ=デモ;存続セキュリティ情報=真;ユーザID =寺;パスワード= 123456; multipleactiveresultsets =真;アプリケーション名= EntityFramework " providerNameで= " System.Data.SqlClientの" /> - > 14 < > /のconnectionStrings 15 <のappSettings> 16 <キー=追加" Webページを:バージョン"値= " 3.0.0.0 " /> 17 <キー=追加" Webページを:有効"値= " 偽" /> 18 <=キーを追加します"ClientValidationEnabled "値= " 真" /> 19 <追加キー= " UnobtrusiveJavaScriptEnabled "値= " 真" /> 20 </のappSettings> 21 <のsystem.web> 22 <コンパイルデバッグ= " 真" targetFramework = " 4.7.2 " /> 23 <のhttpRuntime targetFramework = " 4.7.2 " /> 24 </system.web> 25 <ランタイム> 26 <assemblyBindingのxmlns = "URN:スキーマ-マイクロソフト- com:asm.v1 " > 27 <dependentAssembly> 28 <assemblyIdentity名= " Antlr3.Runtime "なPublicKeyToken = " eb42632606e9261f " /> 29 <bindingRedirect oldVersion = " 0.0.0.0-3.5.0.2 " NEWVERSION = " 3.5.0.2 " /> 30 </ dependentAssembly> 31 <dependentAssembly> 32 <assemblyIdentity名= " Newtonsoft.Json "なPublicKeyToken = " 30ad4fe6b2a6aeed" /> 33 <bindingRedirect oldVersion = " 0.0.0.0-11.0.0.0 " NEWVERSION = " 11.0.0.0 " /> 34 </ dependentAssembly> 35 <dependentAssembly> 36 <assemblyIdentity名= " System.Web.Optimization "なPublicKeyToken = " 31bf3856ad364e35 " /> 37 <bindingRedirect oldVersion = " 1.0.0.0-1.1.0.0 " NEWVERSION = " 1.1.0.0 " /> 38 </ dependentAssembly> 39 <dependentAssembly> 40 <assemblyIdentity名= " WebGrease "なPublicKeyToken = " 31bf3856ad364e35 " /> 41 <bindingRedirect oldVersion = " 0.0.0.0-1.6.5135.21930 " NEWVERSION = " 1.6.5135.21930 " /> 42 </ dependentAssembly> 43 <dependentAssembly > 44 <assemblyIdentity名= " System.Web.Helpers "なPublicKeyToken = " 31bf3856ad364e35 "/> 45 <bindingRedirect oldVersion = " 1.0.0.0-3.0.0.0 " NEWVERSION = " 3.0.0.0 " /> 46 </ dependentAssembly> 47 <dependentAssembly> 48 <assemblyIdentity名= " System.Web.WebPages "なPublicKeyToken = " 31bf3856ad364e35 " /> 49 <bindingRedirect oldVersion = " 1.0.0.0-3.0.0.0 " NEWVERSION = " 3.0.0.0 " /> 50 </ dependentAssembly> 51 <dependentAssembly> 52 <assemblyIdentity名= " System.Web.Mvc "なPublicKeyToken = " 31bf3856ad364e35 " /> 53 <bindingRedirect oldVersion = " 1.0.0.0-5.2.7.0 " NEWVERSION = " 5.2.7.0 " /> 54 </ dependentAssembly> 55 </ assemblyBinding> 56 </ランタイム> 57 <system.codedom> 58 <コンパイラ> 59 <コンパイラ言語= " C#の、CS、CSHARP "拡張子= " は.cs "タイプ= " Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider、Microsoft.CodeDom.Providers.DotNetCompilerPlatform、バージョン= 2.0.0.0、文化=中立、なPublicKeyToken = 31bf3856ad364e35 " warningLevel = " 4 " compilerOptions = " / langversion:デフォルト/ NOWARN: 1659; 1699; 1701 " /> 60 <コンパイラ言語= " VB; VBS、VisualBasicの、VBScriptの"拡張= " の.vb "タイプ= "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider、Microsoft.CodeDom.Providers.DotNetCompilerPlatform、バージョン= 2.0.0.0、文化はニュートラル、PublicKeyToken = = 31bf3856ad364e35 " warningLevel = " 4 " compilerOptions = " / langversion:デフォルト/ NOWARN:41008 /定義:_MYTYPE = \&QUOT;のWeb \&QUOT; / optionInfer + " /> 61 </コンパイラ> 62 </system.codedom> 63 64 65 <entityFramework> 66 <! - MySQLの启用下面一段配置项- > 67 <! - <defaultConnectionFactoryタイプ= " MySql.Data .Entity.MySqlConnectionFactory、MySql.Data。> 68 <パラメータ> 69 <パラメータ値= " v11.0 " /> 70 </パラメータ> 71 </ defaultConnectionFactory> - > 72 <! - SQL Serverの启用下面一行- > 73 <defaultConnectionFactoryタイプ= " システム.Data.Entity.Infrastructure.LocalDbConnectionFactory、EntityFramework " > 74 <パラメータ> 75 <パラメータ値= " mssqllocaldb " /> 76 </パラメータ> 77 < / defaultConnectionFactory> 78 <プロバイダ> 79 <プロバイダinvariantName = " System.Data.SqlClientの"タイプ= " System.Data.Entity.SqlServer.SqlProviderServices、EntityFramework.SqlServer " /> 80 <プロバイダinvariantName = " MySql.Data.MySqlClient "タイプ= " MySQLの.Data.MySqlClient.MySqlProviderServices、MySql.Data.Entity.EF6、バージョン= 6.10.9.0、文化= PublicKeyTokenニュートラル= c5687fc88969c44d " > 81 </プロバイダ> 82 </プロバイダ> 83 </ entityFramework> 84 85 < system.data> 86 <DbProviderFactories> 87 <不変=削除" MySql.Data.MySqlClient " /> 88 <名前=追加" MySQLのデータプロバイダ"不変= " MySql.Data.MySqlClient "説明= " MySQLの.NET Frameworkのデータプロバイダ"タイプ= " MySql.Data.MySqlClient.MySqlClientFactory、MySql.Data、バージョン= 6.10.9.0、カルチャニュートラル、PublicKeyToken = = c5687fc88969c44d " /> 89 </ DbProviderFactories> 90 </system.data> 91 92 </設定>
DBContext設定:
this.SetSqlGenerator( "MySql.Data.MySqlClient"、新MySql.Data.Entity.MySqlMigrationSqlGenerator());
若しくは
DBContext.cs
[DbConfigurationType(typeof演算(MySql.Data.Entity.MySqlEFConfiguration))]