0

I'm new to ASP.NET and MVC, trying to move from WinForms. I'm using Visual Studio 2017 Pro, and I am trying to follow some tutorials for connecting to an existing MySQL database. I plan to use the Database First method as the database already exists. I have the following config :-

Windows 10 Pro 64 bit on my PC

VS 2017 Pro MySQL for Visual Studio 2.0.5 MySQL Connector 6.10.4

  • EntityFramework v6.2.0
  • Mysql.Data 6.10.4
  • Mysql.Data.Entity 6.10.4
  • Mysql.Web 6.10.4

I can make a database connection using the Server Explorer, but when I'm using the EDM wizard to create the model from the database, the connection isn't showing in the drop-down box, and if I try to create a new one, the MySQL driver doesn't show as an available option, only SQL Server.

I've tried various combinations of MySQL for VS, MySQL Connector, EF and MySQl components (older versions) but I can't seem to find a winning combination.

Has anyone managed to achieve this ? I'm pulling out what's left of my hair. Thanks.

enter image description here enter image description here

9
  • 1
    The EDM Wizard requires designer support, as half of the model is mappings from the model to the actual database schema. You'll have to find and add the appropriate designer packages. It's also deprecated, along with all the EDMX stuff. EF Core doesn't support it at all. Devs avoid it for valid reasons - hard to version, complex to change. It's easier to reverse engineer a database and update the model, mappings as needed Commented Oct 30, 2017 at 13:26
  • Thanks for the reply, looks like I have a lot more reading to do if this is deprecated. Commented Oct 30, 2017 at 13:55
  • Not as much as you think - it's actually easier to work without EDMX. You can reverse engineer classes from the database or views. You shouldn't have one big model with 100s of tables anyway - such models make it very hard to change anything without breaking stuff. EDMX hides the actual classes which makes it harder to add, eg read-only properties, methods. Commented Oct 30, 2017 at 14:07
  • You can start by mapping only a few tables at a time. Consider your contexts as boundaries around business-related entities (yes, I know it sounds like DDD). Don't map columsn in a context if you don't actually need them. You'll see it's actually easier to grow your application this way. It's also easier to modularize (ie break it apart) if you find that it grows too big. Try doing that with an EDMX model Commented Oct 30, 2017 at 14:10
  • Thanks again Panagiotis, I've started with a couple of basic models to match tables, but it's not very intuitive, especially trying to match foreign keys. I'll soldier on. Commented Oct 30, 2017 at 15:03

1 Answer 1

0

OK I finally found an answer, I now have EF 6.1.3 and MySQL Connector 6.9.9 installed.

I needed to change the part of the Web.Config file as described by James Wilkins in this post.

Thanks to Panagiotis for your help.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.