We're trying to use an Entity Framework Model-First approach with Oracle 11g and ODP.NET 11.2.0.3.20. We'd like to use EF 4.1 or EF 5.0 with DbContext
.
Short version: Has anyone managed to do that?
Long version:
On VS2010 and Entity Framework 4.0, everything works fine. I'm able to Generate Database from Model
.
When I try it with EF 4.1 or EF 5.0, I always end up with an Object reference not set to an instance of an Object
error message in Visual Studio:
I tried it the following ways:
- Created a new EF 5.0 model in VS2012, set code generation workflow and templates to the Oracle stuff (
Generate Oracle via T4 (TPT).xaml
andSSDLToOracle.tt
). Then I clicked onGenerate Database from Model
and chose a working Oracle connection, but Visual Studio just shows that error. - Created an EF 4.1 model in VS2012, same error.
- Created an EF 4.1 model in VS2010, same error.
- Tried a Database-First approach in EF 5.0 and EF 4.1, same error.
It only works if I'm using VS2010 and EF 4.0.
However, Oracle claims that it should work, see http://www.oracle.com/technetwork/topics/dotnet/downloads/install112030-1440546.html :
ODAC supports DbContext APIs.
Has anyone managed to use EF 4.1 or 5.0 with Oracle ODP.NET?
EDIT: Turns out it works fine on a 32-bit virtual machine. The problem is only there on my 64-bit Windows 7 machine.
Just delete corresponding connectionstring from project config file. Then choose new connection (to Oracle database) and click to generate DDL.