HaPpY hApPy
Visual studio 에서 MySql 연결하기 본문
First of all, we don't even need to install the mysql-installer-community-5.7.3.0-m13.msi.
- Install the latest mysql-visualstudio-plugin
- Install the latest mysql-connector-net
- New C# .Net 4.5 Framework WinForms (for 4.0 it should work based on Does Entity Framework 6 support .NET 4.0? )
- Install 4 Nuget Packages (follow sequence, if you install Mysql.Data.Entities before EntityFramework, it will resolve dependency and install EntityFramework 6.0.2 but what we need is EntityFramework 6.1.0)
EntityFramework
Mysql.Data
Mysql.Data.Entities
Mysql.Web
5.If you have tag entityFramework in App.config, please comment it and insert new tag entityFramework in App.config after tag startup
<entityFramework>
<defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" />
<providers>
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
</providers>
</entityFramework>
6.Add ADO.NET Entity Data Model (as mentioned in question)
7.After Entity Connection string is generated (as mentioned in question) and Tick Save entity connection settings in App.Config as then click Next
8.Choose Your Database Object and Settings (Tables, Views, or Stored Procedures and Functions) (Don't have "Which version of Entity Framework do you want to use?" because I have only oneEntity Framework 6.0 provider so direct skip the selection if my only provider is valid)
9.Finish
Congratulations ^^
By the way, you may need to add the .dll files
- MySql.Data.dll
- MySql.Data.Entity.EF6.dll
- MySql.Web.dll
inside this folder
C:\Program Files\MySQL\MySQL Connector Net 6.8.3\Assemblies\v4.5 (32bit windows)
C:\Program Files (x86)\MySQL\MySQL Connector Net 6.8.3\Assemblies\v4.5 (64bit windows)
as your project reference for further EF6 functions.
'MySql' 카테고리의 다른 글
Mysql EntityFramework error The value for column 'IsPrimaryKey' in table 'tablename' is DBNull 발생때. (0) | 2016.07.24 |
---|