简体   繁体   中英

Using Entity Framework 6 with MySQL

I've been trying to connect to a MySQL database which is hosted on a RaspberryPI and I have been having a lot of trouble and wanted to know if it is possible before I continue.

I want to use .Net's Entity Framework 6 on Visual Studio 2013 in the same fashion as you would SQL Server to create Entites from the Database. First of all is this possible?

I have had two problems so far:

Firstly, I have been able to connect to a MySQL database on my local copy but not the Raspberry Pi's even though I have a user which allows any IP and has most privileges (I am connecting through LAN).

只能通过localhost登录

My Second problem is that once I have accessed and picked a database I receive this error, which makes me think that Entity Framework doesn't support MySQL:

实体错误

I am also having a problem logging into my local instance of MySQL when the user has a password, which makes me think this could also be why I can't login to the remote MySQL?

You'll have to use an EF Provider to use MySQL and Entity Framework together. Some older Providers don't work with EF at all, or only previous versions.

Connector.NET is the 'official' solution: http://dev.mysql.com/doc/connector-net/en/connector-net-entityframework60.html

There is also some tooling from Devart (DotConnect) that may work 'better' than the MySQL Connector.NET. The reason I say that is in my experience Oracle's EF Provider (For Oracle) was not nearly as easy to set up / maintain as the Devart Solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM