Search Wiki:
Resource Page Description
Sample Entity Framework Provider for Oracle. Works with Oracle 10g by wrapping System.Data.OracleClient APIs. It is compatible with Entity Framework released as part of .NET Framework 3.5 SP1.


DISCLAIMER

This is an unsupported sample and should be treated as such. Although reasonable effort has been put to make sure that basic EF scenarios work with Oracle, there are certain limitations. Use in production environment is strongly discouraged.

INSTALLATION

  1. Install Visual Studio 2008 SP1 Beta.
  2. Install Oracle 10g Express Edition from http://www.oracle.com/technology/software/products/database/xe/index.html
  3. Add new user "edmuser" with password "123456" (if you change the user name/password you will need to update connection strings). The user needs to have permissions to create database objects (assigning the user to DBA role is the quickest way to give necessary permissions).
  4. The default connection string is using XE name from tnsnames.ora. If you have installed a different version of Oracle or used different instance configuration, you will have to update connection strings in App.config files.
  5. Review "OracleNorthwind/install_db.cmd" and adjust path to sqlplus.exe as necessary then run the batch file. It will create and populate a Northwind sample database in "edmuser" schema.
  6. Open the solution file EFOracleProvider.sln and run "EFOracleProvider.AdHocTests" and "Entity Framework Query Samples"

KNOWN ISSUES

  1. {BINARYFLOAT/BINARYDOUBLE} types are not supported. This is a limitation of underlying System.Data.OracleClient. Columns using those types have been replaced with NUMBER.
  2. Subqueries with aggregates are not supported. See RunNestedSubquery() method for an example. Users will see ORA-00904. This issue in Entity Framework has been fixed in post-beta builds and the fix will be included in final version of Visual Studio 2008 SP1.
  3. FunctionImportMapping does not call GetEdmType() when validating parameter mapping. As a result it is not possible to map Edm.Int32 to Oracle.EFOracle(Precision=11,Scale=0). This issue in Entity Framework has been fixed in post-beta builds and the fix will be included in final version of Visual Studio 2008 SP1.
  4. Oracle DDEX Provider for Visual Studio is not included. Example DDEX provider that supports SQL Server is available as part of EF Sample Provider at http://archive.msdn.microsoft.com/EFSampleProvider
  5. APPLY operator is not supported by Oracle. As a result, certain queries that internally use this operator (such as "Average - Grouping 1", "Max - Grouping", "Min - Grouping") are not supported.
  6. Certain functions (AVG in particular) return numeric values that cannot be properly materialized as decimal by System.Data.OracleClient. As a result users will get OCI-22053 (overflow).
Last edited Jun 24 2008 at 1:11 AM  by jkowalski, version 6
Comments
Hollywood wrote  Jul 4 2008 at 1:16 PM  
I work on a project which works on two databases : SQL Server and Oracle.
Could I create two EDMX files, one for SQL Server (using Microsoft provider), the other for Oracle (using this provider) ?
The choice of the database could be a parameter on my web.config file...?

Thx

pisoias wrote  Aug 13 2008 at 2:35 PM  
Hello, I've migrated an edmx to use this Oracle provider (and also migrated the MSSQL database to Oracle 10g). Now I'm getting the following:

Schema specified is not valid. Errors:
EFOracleProvider.Resources.EFOracleStoreSchemaMapping.msl(3,4) : error 2002: The EntityContainer 'SchemaInformation' for the conceptual model specified as part of this MSL does not exist in MetadataWorkspace.

I don't know what that means, please help !
Thanks

shinji14 wrote  Jan 23 2009 at 5:14 AM  
How this thing work with stored procedures?

FerHenrique wrote  Jan 29 2009 at 11:16 AM  
jkowalski,
I would like to know if this example works with LINQ to Oracle...
thanks...

ddwoske wrote  Nov 3 2009 at 8:42 PM  
Will it work with Oracle 11g and/or VS 2010.. anybody try it?

HSchoefer wrote  Dec 1 2009 at 11:55 AM  
gonna try it tomorrow.

alexanderfedin wrote  Feb 8 2010 at 9:43 PM  
Can anyone tell me how to install the EF Data Provider?

ebonnett wrote  Jun 15 2010 at 7:24 PM  
I successfully got this working under VS 2010 with Oracle 11g. You have to open the solution from within VS and let it convert it. Then, you must modify the Post-Build event on the EFOracleProvider project as it references the gacutil.exe in the ...6.0A\Bin directory. I had to change mine to the 7.0A\bin directory.

guoping wrote  Jul 5 2010 at 8:59 AM  
..Context.Objects.Where(o=>o.StrField.IndexOf("test")>=0)..,

Generated sql is:

..where instr('test',"Objects"."StrField")>0..

Beppe71 wrote  Dec 15 2010 at 11:14 AM  
hi,
i tried to install and execute, and it seems to work. In the output window I read some generated SQL queryes (eg: SELECT
"Extent1"."CategoryID" AS "CategoryID",
"Extent1"."CategoryName" AS "CategoryName",
"Extent1"."Description" AS "Description",
"Extent1"."Picture" AS "Picture"
FROM "Categories" "Extent1"
WHERE ("Extent1"."CategoryID" = :p__linq__2) AND (ROWNUM <= (1) ))
but what I expect to find is some interactive environment where I could set parameters and see query results displayed. Nothing of that happened. Please can anybody explain how does it work?
Another question: how can I fit this sample to my Database? I tried to create WPF application with Visual Basic; then I tried to create a Entity Data Model, but I could not get to connect the .edmx file to my Oracle DB, because I just can see SQL Server Drivers!

rrv wrote  Feb 4 2011 at 10:06 AM  
This provider is not able to generate anything related to "SEQUENCES" of Oracle. Can somebody help us in using Sequence to create running sequence number as primary key in a table?
Thanks
Venkat

rrv wrote  May 3 2011 at 3:42 PM  
Beppe71, You could use RV's Entity Visualizer to view the native SQL, choose appropriate available providers via a combo box and execute the SQL query. Also can change the parameters every time and change provider at will. This free tool/visualizer for VS2010 and VS2008 are available at www.rajavenkatesh.com/projects.aspx.
Regards
Venkat

Updating...
Page view tracker