Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Commented Issue: Issue with Oracle and Entity Framework [831]

$
0
0
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.


Comments: 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).

Viewing all articles
Browse latest Browse all 10318

Trending Articles