1

I am looking to use Entity framework as database layer in my application, but I found that it didn't support oracle database and I will need to use third party provider for this purpose.

However I want to build database layer support multiple database (Oracle , MS Sql Server) and in the same time support entity model like LinqToSql and devart.

if any one has any information can help me I will be grateful. Thanks.

kaito ked
  • 175
  • 1
  • 1
  • 15

3 Answers3

1

What you want here is probably a repository pattern, something that can sit in the middle so that your application doesn't care how the underlying data is stored.

You could use something like my repository pattern (read about it here : http://blog.staticvoid.co.nz/2011/10/staticvoid-repository-pattern-nuget.html) and implement a custom IRepositoryDataSource for oracle (you could do this by using the LINQ to oracle provider from codeplex, http://linqtooracle.codeplex.com/) or alternatively you could write your own repository with implementations for both sql and oracle.

undefined
  • 33,537
  • 22
  • 129
  • 198
  • Entity Framework already abstracts from the database. You wouldn't want to implement another repository on top of that. – usr Mar 04 '12 at 13:30
  • Entity Framewok does not completely abstract from the database. Although it appears to. If you place a breakpoint anywhere that you are using EF generated entities, you will see that the compiler has generated a proxy class that is not the same type as your entity class. This has implications for reflection and binary serialization of those classes, although xml serialization seems to be ok. These proxies contain the data and behaviour used to track changes. A true abstraction would require a repository pattern or some kind of mapping to a POCO dto – Daniel Dyson May 04 '12 at 08:37
1

I found that linqconnect component from (devart) does what I need.

Matt Fenwick
  • 48,199
  • 22
  • 128
  • 192
kaito ked
  • 175
  • 1
  • 1
  • 15
1

Entity Framework does not include an out-of-the-box provider for any RDBMS other than SQL Server. Any third-party RDBMS vendor that wants to support EF is expected to provide its own implementation based on Microsoft's provider model. Oracle has in fact released an official provider that is part of ODP.NET. I would recommend this one because it is free:

http://www.oracle.com/technetwork/issue-archive/2011/11-sep/o51odt-453447.html

P.S. - The Devart LinqConnect providers are not really Linq to SQL providers. They provide classes that mimick the structure and functionality of the Linq to SQL classes (DataContext, EntitySet<T>, etc.), but they are in a different namespace. It is impossible for anybody other than Microsoft implement a Linq to SQL provider, because they never exposed the provider model through public types.

luksan
  • 7,661
  • 3
  • 36
  • 38