Supporting multiple databases with entity framework - mysql

My client has an asp.net application - a product used my several customers. It connects to MSSQL database using good old ado.net and stored procedures. I am supposed to rewrite the application so that the application supports MySQL and Oracle in addition to MSSQL. I am supposed to use entity framework to do this. I am new to EF. So can any one guide me as to how this can be done? Where should I start?

Related

Is Entity Framework a good choice for an asp.net application that has to connect to MsSql,Mysql and Oracle databases?

I want to know if Entity Framework can be used to create an architecture such that the asp.net application connects to MSSql,Mysql and Oracle database just by changing the connection string. If it is possible how do I proceed with it? If not what is the next best alternative? I am working on a product that is used by different customers - some prefer MsSql, some prefer Mysql and very few prefer Oracle. This means all three databases will have identical schema.
I have used EF with both Oracle and SQL Server. It works really well with SQL Server and reasonably well with Oracle.
However, I wouldn't have the application talk directly to EF itself. There are bound to be subtle differences between the databases that you don't want your core application to deal with. Instead, use something like the Repository Pattern and have your app talk to a repository interface. Create a repository for each database that you can plug into your app. You can certainly use EF in your repositories to map data between the database and your domain classes; but as good practice, your application shouldn't know about your data access or database technology.
If you are planning to use entity framework 6, currently not supported by oracle. But EF 5 would work right now. I am very optimistic that oracle would provide support for ef 6 in future. I have used EF5 to connect to mysql, oracle and sql server successfully using repository pattern and unit of work pattern and running successfully in production. Read also domain driven design (domain driven pattern/table pattern) and onion architecture

Entityframework vs NHibernate in Mysql

Hey Friends i need one suggestion regarding to EF and Nhibernate. Currently i am developing an application in MVC4 using MSSql 2008 R2 and entity framework. But now i have to use Mysql 5.5 as database. As i am completely new to mysql i don't whether EF is supportive to it or not.
I search in net and get some information about it. But i want to know whether it is better to use *NHibernate* or EF in mysql 5.5. And Whether EF in mysql is as similar to MSSql
Thanks for any suggestion
My personal rule of thumb is that if you are developing application using SQL Server ONLY than go for Entity Framework as they are rapidly improving and bringing out great features.
Whereas if you have to work with other database as well, Oracle and MySql etc, then go for NHibernate, their community is larger and proven.

Any better way to use Oracle/MySQL with .NET Entity Framework?

I wonder the simplicity of working with Microsoft SQL database server with .NET Entity Framework. Is there a possible way to use it with Oracle & MySQL database servers?
You could use another ORM, like NHibernate which supports Microsoft SQL, Oracle, and MySQL, among many others.
If you want/need to stick with EF, there are already questions on SO about using it with MySQL and with Oracle.
Oracle Data Access Components for .NET (http://www.oracle.com/technetwork/topics/dotnet/downloads/oracleefbeta-302521.html) includes also Oracle Data Provider for .NET 4 11.2.0.2.40.
A nice tutorial how to use Model-First approach can be found at http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/dotnet/EntityFrameworkOBE/EntityFrameworkOBE.htm.
Good luck,
LM
A list of Oracle providers for Entity Framework can be found here:
Comparison of Entity Framework compatible providers for Oracle?
And for MySQL these are available:
http://www.mysql.com/products/connector/
http://www.devart.com/dotconnect/entityframework.html
http://uda.openlinksw.com/dotnet/

WCF: Best way to get data from Oracle 10g, MySQL and SQL Server 2008 databases?

I am designing a simple C# WCF service using ASP.NET 4.0 and hosted on IIS7, which will be used by .NET and Java web applications and desktop applications to extract data stored in various databases (both local and remote). I am starting to learn how to use VS2010 and WCF after working for a few years on VS2005 and asp.net web services, so am somewhat of a noob to WCF but know a bit about web services and Visual Studio.
Does anyone have opinions on what the best approach would be in terms of project/class/file setup in Visual Studio 2010 to do this, seeing as how I want to maximize code re-use and minimize development time yet still have the ability to connect to the different databases? I have a WCF Service Application project for the service, and have generated a WCF Client to use for testing using svcutil.exe, but now I'm at the point where I need to start writing database access layer code (or "model" code for MVC if that's the design route I need to go down).
Any help appreciated, thanks!
Each of the databases will have their set of nuisances while integration. The first thing you need to start with would be to design your model in more of OO (Object Oriented) fashion than relation DB way. Once such a model is created, you need to implement mapper layer/classes that would map data from a relational form to a OO format. Then for each DB you need to write some data access code. The amount of code you write for data access may well depend upon the tools\technologies you use. You could look into Entity Framework or NHibernate or other such ORMs to decrease the code required to access data. But keep in mind these ORM mappers may require their own set of tweaks to work well with MySQL, Oracle, SQL Server.

LINQ2SQL Database providers

I have heard that LINQ2SQL has been written to support multiple database vendor providers however for internal political reasons at MS, only SQL Server has been supported.
Is this a fair summary of the situation, and if so has a timetable been released as to when other databases will be supported?
I am aware of Matt Warren's BUILDING AN IQUERYABLE PROVIDER series on the wayward weblog, but I would prefer not to build something now that will be released (probably better than I will do it) later
Check the ADO.NET Entity Framework (and Linq to Entities), you can look here also a Sample Entity Framework Provider for Oracle, and here are more examples about creating Data Providers for EF.
Entity Framework has support for multiple database providers. There are no plans to expose or implement additional LINQ to SQL database providers.