How do I create a MySQL database connection string in a C# project without utilizing dialog boxes?

.net c# datasource entity-framework mysql


NOTE: Apparently, the reason the MySQL connector installation doesn't show up automatically in the Dialog Boxes for adding a data source is because the Visual 2008 Express Edition doesn't allow "3rd party integration" within the Visual Studio IDE. So, this makes setting up the data source manually even more important because the integrated tools from the MySQL connector aren't present.

My goal is to set up a connection to a MySQL database using Entity Framework (an ADO.NET Entity Data Model). I'm getting frustrated by all the wizards and dialog boxes and I still can't find what I'm looking for.

Here's what I've done so far: I just installed the MySQL .NET Connector v6.1.3 on my machine (to my knowledge, it is correctly installed. It shows up in Add/Remove Programs in the Control Panel). In Visual Studio (Visual C# 2008 Express Edition SP1 with Entity Framework Version that ships with SP1), I click to add a reference to a project, click on "ADO.NET Entity Data Model" and that brings me to a screen that asks "What should the model contain?" I select "Generate from database" and then click Next.

This screen asks me which data connection I should use. I click "New Connection" and get a screen that looks like this:

Where's an option for the ADO.NET MySQL Connector that I just installed?

I know where to find the connection string for MySQL, but I can't figure out how to get it into my application so that Visual studio recognizes it, uses the ADO.NET connector, and allows me to select that connection to create an Entity Model. How can this be accomplished?

2/8/2017 2:18:01 PM

Accepted Answer

Use the app.config (or web.config) file to add a entry. Be sure the specify the provider= attribute correctly with the MySQL provider.

12/8/2009 12:37:28 AM

Popular Answer

There is no support for third-party extensions in Visual C# 2008 Express Edition SP1.

This is mentioned in this blog post by Dan Fernandez.

More information about the difference between Express and Professional editions is available here in the Visual Studio 2008 Product Comparison article.

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow