Reputation: 2908
I've written a ASp.net C# .NET 4.0 application and I've used Ms SQL2008 DB.
It's a 2 tier application... BLL/DAL and UI
I have used
- tables (with multiple index to make the record unique)
- relationals between tables (1 to m relation)
- Entity Framework for Datamodel
- LINQ (update/insert/select/delete)
I haven't used
- Storedprocedures
- Views
- Tsql
- no manual SQL operation
- etc.
So If you see it's very easy setup. The application uses MsSQL2008 DB
so my question is: I need to use MySQL (request of client).
What do I need to do? Since I've used Entitiy Framework I think this should be easy done right?
How can I make that the application can use MySQL / or can support both (my SQL/Mysql).
please advice?
Upvotes: 3
Views: 3630
Reputation: 364249
EDMX file consist of three parts:
If you want to use multiple database servers you must have at least separate SSDL for each of them (if you are going to use different table or column names per database you must also have separate MSL).
When your library is compiled those three parts are extracted into separate files and included as resources to your compiled dll. That are those strange things referenced from EF connection string. You can switch the generation in EF designer and those files will be deployed to your bin directory instead.
The problem with supporting multiple database server is that you need multiple SSDL files. VS and EF designer allows you working with SSDL only within EDMX and each EDMX can have only single SSDL. So your options for supporting multiple DBs are:
To make it work at runtime you need MySQL provider for EF - for example the connector mentioned by @ChristaanV and you must reference correct SSDL in connection string for MSSQL and MySQL.
Btw. next time learn which DB customer requires before you develop the application. It is real analysis / requirement failure to develop application for platform customer don't support.
Upvotes: 3
Reputation: 5541
You can install the Mysql .Net connector and in your EDMX file you can select DDL Generation Template = SSDLToMySQL.tt (VS)
It will than generate the sql code based on Mysql.
Upvotes: 1