1

Closed

Issue with Oracle and Entity Framework

description

Hi All,

I'm working on small POC( Entity Framework with Oracle) and I'm getting below error
"A null was returned after calling the 'get_ProviderFactory' method on a store provider instance of type 'System.Data.OracleClient.OracleConnection'. The store provider might not be functioning correctly."

I have below connectionstring setting
<add name="StoreContext" connectionString="data source=localhost:1521/XE;User ID=sales;Password=xxx;" providerName="System.Data.OracleClient" />

Contact Class
public class StoreContext:DbContext
{
public DbSet<Product> Products { get; set; }
public DbSet<Category> Categories { get; set; }
}

public class Product
{
public int ProductID { get; set; }
public string ProductName { get; set; }
public string QuantityPerUnit { get; set; }
public decimal UnitPrice { get; set; }
public int CategoryID { get; set; }
public virtual Category Category { get; set; }
}
public class Category
{
public int CategoryId { get; set; }

public string CategoryName { get; set; }

public virtual ICollection<Product> Products { get; set; }
}

I have kept tables/datatype identical in both Oracle and SQL server and same piece of code working with SQL Server and not with Oracle. Any help will be appriciated.
Closed Feb 22, 2013 at 10:54 PM by moozzyk
The customer seems to be using not an EF capable provider.

comments

moozzyk wrote Jan 29, 2013 at 1:29 PM

Which Oracle provider are you using (if any - this seems like none was installed). Also, I don't think that Oracle EF provider from Oracle supports Code First yet (I don't know about the provider from Dev Art).

This kind of problems can be probably resolved quicker when asked on stack overflow as this does not seem to be an issue with EF.

RoMiller wrote Jan 31, 2013 at 10:18 PM

EF Team Triage: Assigning to a member of the EF team for further investigation. Once we have investigated the issue we will decide whether to fix it and if so, which release to fix it in.

moozzyk wrote Feb 22, 2013 at 6:36 PM

System.Data.OracleClient is an ADO.NET provider but is not an EF Provider. In addition it has been deprecated since .NET Framework 4 (http://msdn.microsoft.com/en-us/library/77d8yct7.aspx). The customer needs to use an EF enabled ADO.NET provider that supports Code First (I believe ODP.NET does not support Code First at the moment, I don't know about DevArt's Oracle provider).

moozzyk wrote Feb 22, 2013 at 7:00 PM