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

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/

Related

Supporting multiple databases with entity framework

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?

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

Using LINQ with databases other than SQL Server Express 2005

I'm just starting to look into using LINQ for my database (and XML, and data object!) needs, but need to decide on which database to go with. I've been reading Pro LINQ, and it says that currently, LINQ in .NET 3.5 only supports SQL Server. I have done some googling, and have found references to using LINQ with MySQL and PostgreSQL (my other two DB options), but they are refer to DLinq, which I understand to be the predecessor of LINQ to DB.
I've read interesting and informative comparisons of the three databases here and here, but am still torn. I do not have any in-depth database experience, so it's important to be able to get the software installed and configured easily, or at least be easy to figure out how to compile a list of steps to configure it. I definitely want to have transactional support as well. But most importantly -- I want to use LINQ.
I'd like to hear what everyone here is using, whether it's SQL Server because LINQ supports it natively, or the other two with some additional component for LINQ support that I haven't yet found.
We use devart's dotConnect provider for Linq-to-Oracle and have been very pleased. They try and make the functionality match Linq-to-SQL as close as possible, which seems to be what you're looking for.
They have providers for:
Oracle
MySQL
PostgreSQL
SQLite
SQL Server
From a cost perspective, it's an excellent deal I'd say, just pay for developer seats, no server licensing.

What database vendors does LINQ to SQL support?

I'm kind of new using LINQ to SQL and when ever I try to use a non sql server dbs I get an error that it is an unsupported data provider. Is there a way to get LINQ to work with dbs like Oracle and SQL sdf files?
In order to use LINQ to communicate with a given DB backend, you need to get a DB specific provider. For oracle, try the following project on codeplex
http://www.codeplex.com/LinqToOracle
The DbLinq project supports all of Linq to Sql's features over MySQL, PostgreSQL, Oracle and SQLite, as well as some unique features. It is also the base of Mono's implementation of Linq to Sql.
Not officially, but there are a variety of projects implementing LINQ to SQL for other databases, for example: http://www.codeplex.com/LinqToOracle
Although you specified LINQ to SQL you might also want to consider the Entity Framework which does support different databases. You can find some supported providers here. The first 3 providers on that page support ORACLE.
If you want start a new project that is not SQL Server and you want to use a Microsoft ORM I recommend you to start using Entity Framework which supports MySQL and Oracle and ... and also you can use LINQ to Entity to communicate between your application and EF generated classes.
Hope this helps
Take a look at the Devart LINQ to Oracle tutorial.
But please note that you are not able to mix data from SQL Server and Oracle datacontexts.

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.