前言
本篇提供使用Entity framework,資料來源為MySQL的使用者參考。測試環境:
Visual studio 2015 community
MySQL 5.6.25-log
目錄
1.Insatll Download MySQL for Visual Studio2.Install Download Connector/Net
3.Setting on Visual studio
重要:一定要先安裝Download MySQL for Visual Studio,再安裝Download Connector/Net
Impotrtant: Always install the MySQL for Visual Studio before installing MySQL Connector/Net.
Insatll Download MySQL for Visual Studio
下載 MySQL Installer,選擇安裝 MySQL for Visual Studio或
直接下載 MySQL for Visual Studio
You can download MySQL Installer, select and install MySQL for Visual Studio
or
directly download and install MySQL for Visual Studio
Step.1 開啟 MySQL Installer ,進行下載安裝程式。
Open MySQL Installer and download installer
Step.2 點選安裝程式進行安裝
Click Installer and install
Step.3 安裝中
Processing
Step.4 關閉相關程式
Close related application
Step.5 點選下一步
Click Next
Step.6 選擇MySQL for Visual 1.2.6 後點下一步,點選執行
Select MySQL for Visual 1.2.6, Click Next, then click excute
Step.7 安裝中
Installing
完成後,接下來要安裝Connector/Net
After installing MySQL for Visual Studio, We need to install Connector/Net
Install Download Connector/Net
Step.1 開啟 Connector/Net ,進行下載安裝程式。
Open Connector/Net and download installerStep.2 點選安裝程式進行安裝
Click Installer and install
Step.3 點選執行
Click Excute
Step.4 點選下一步
Click Next
Step.5 點選Typical
Click Typical
Step.6 點選Install
Click Install
Step.7 選擇Visual Studio 2015
Select Visual Studio 2015
Step.8 安裝完成
Finish
Setting on Visual studio
Step 1.開啟Visual Studio 2015, 選擇 File -> New -> Project
Open Visual Studio 2015, Select File -> New -> Project
Step 2.選擇 ASP.NET Web Application, 輸入專案名稱
Select ASP.NET Web Application, Enter name: MySQLTest
Step 3.選擇 MVC
Select MVC
Step 4.右鍵點選References -> Add reference
Right Click References -> Add reference
Step 6. 開啟Web.config, 找到
Open Web.config, find
Step 6. 瀏覽並加入下列 dll
browse and add following dll:
MySql.Data.dll
MySql.Data.Entity.EF6.dll
MySql.Web.dll
位置(Path):
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)
Step 7. 點選 View -> Sever Explorer, 右鍵點選 Data connections, 點選Add connection..
Click View -> Sever Explorer, right click Data connections, Click Add connection..
Step 8. 點選Change...
Click Change...
Step 9. 選擇 MySQL Database, 點選OK
Select MySQL Database, Click OK
Step 10. 輸入Sever name, User name ,Password, and database name.
Enter Sever name, User name ,Password, and database name
Step 11. 右鍵點選Model 資料夾 -> Add -> New Item
Right click Model folder -> Add -> New Item
Step 12. 選擇 Data -> ADO.NET Entity Data Model, 點選 add
Select Data -> ADO.NET Entity Data Model, Click add
Step 13. 選擇 EF Desginer from database, 點選Next...
Select EF Desginer from database, Click Next...
Step 14. 選擇connection, 點選 Next...
Select conntecion, Click Next....
Step 15. 選擇需要載入的table, 點選 Finish.
Check tabkes, click Finish.
完成Model載入後,即可以開始進行開發。
參考資料
https://dev.mysql.com/doc/visual-studio/en/visual-studio-install.htmlhttp://qursaan-howto.blogspot.tw/2014/07/solve-your-project-references-latest.html
上一篇:[Asp .Net MVC] Entity framework database first with localdb
下一篇:[Asp .Net MVC] Entity framework code first with localdb
本篇文章內容歡迎分享,轉載與使用圖文請來信告知並註明出處。
1 留言
How to Configure MySQL with ASP.NET Entity Framework? Contact to DB Installation Support | Cognegic
回覆刪除Designing MySQL with ASP.NET is a testing assignment for those clients who don't have information and abilities of arrangement. On the off chance that you physically attempting to take care of this issue at that point may be it requires long investment to settle or likewise not ready to investigate this issue. At that point for what reason not you run with outstanding amongst other RIM bolster supplier who explains your everything setup related issues. Draw your stuns up and contact to DB Installation and Configuration Support or DB Configuration Support. Here we are dealing with your need what you hoping to us and we likewise ensured to take care of your concern.
For More Info: https://cognegicsystems.com/
Contact Number: 1-800-450-8670
Email Address- info@cognegicsystems.com
Company’s Address- 507 Copper Square Drive Bethel Connecticut (USA) 06801