Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6018335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:15:38+00:00 2026-05-23T03:15:38+00:00

I currently have an application which uses EF database first which was built against

  • 0

I currently have an application which uses EF database first which was built against SQL Server database. I would like to allow the ability to connect to either MSSQL or MySQL.

I assumed that by using EF I could just change the connection string to point to MySQL, however, when I do that I get the following error:

Unable to cast object of type
‘MySql.Data.MySqlClient.MySqlConnection’
to type
‘System.Data.SqlClient.SqlConnection’.

What other steps are needed to make EF work with MySQL and MSSQL.

Update:
Connection String:

<add name="EntityConnString" connectionString="metadata=res://*/Entities.csdl|res://*/Entities.ssdl|res://*/Entities.msl;provider=MySql.Data.MySqlClient;
provider connection string=&quot;server=localhost;User Id=root;password=password;Persist Security Info=True;database=mydb;Connection Protocol=NamedPipe&quot;" providerName="System.Data.EntityClient" />
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:15:39+00:00Added an answer on May 23, 2026 at 3:15 am

    You need separate EDMX for that – or at least SSDL part and most probably also MSL part specified in the connection string. The reason is that SSDL (storage description in EDMX) is provider dependent = at the moment your SSDL says: “I can connect only to MSSQL”. If you want to support MySQL you need SSDL which will say: “I can connect only to MySQL” and define the connection string accordingly to used database server. SSDL contains database specific definitions. If your MySQL database will use different names of tables or columns or different schema you will also need a new MSL part (describing mapping between database tables and your entities).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF application which uses a (currently) local database to act as
I currently have a functioning in-house Windows Forms application which extensively uses the DataGridView
Background Currently I have a C# Silverlight business application which uses RIA Services. The
I currently have an application which needs to have an awareness of which monitor
I'm developing an application which currently have hundreds of objects created. Is it possible
I currently have an MS Access application that connects to a PostgreSQL database via
I currently have heavily multi-threaded server application, and I'm shopping around for a good
I have a flash application which uses a single php file to retrieve records
We have an AIR application which connects to a WAMP server. We support tiff
I have a few C# .dll projects which are common to many applications. Currently,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.