Zeus82
Zeus82

Reputation: 6375

Entity Framework 6 Switch between DB Providers

I know in past versions of EF, in order to support say MySql and SQL Server, you needed to write your own ssdl. Now with EF 6, the SSDL is embedded in the edmx. So does that mean all I have to do is add another "Schema" tag for the new provider in my edmx?

Update

So I tried added another "schema" node to my ssdl with the hopes that based on the connection string, EF would know which schema to use. That did not work. The best I can get so far is to comment out the "Schema" tag in my edmx for the DB provider that I am not using... not a great solution, but I feel like it's a step in the right direction. still can't quite change db providers on the fly...

So basically if I am going to use MySql, I would comment out all but the MySql "schema" tag and update the connection string in my app config to point to the MySql db.

Upvotes: 3

Views: 2599

Answers (1)

Zeus82
Zeus82

Reputation: 6375

Ok, so I figured it out. Turns out all you have to do is define a new SSDL. I followed this tutorial, and it worked well. I ended up using VistaDB and SQL Server. Just make sure your datatypes match if you are using MySql

Upvotes: 3

Related Questions