Posts

Showing posts from August, 2015

Using Entity Framework 6 Code First with Oracle 11g

Configuration I have used ODP.NET provider for this, which can be easily found on Nuget. The main configuration change here is the EF provider and connection provider. Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices is the EF provider and Oracle.ManagedDataAccess.Client.OracleClientFactory is the Oracle connection provider; both providers need to registered. You can registered these either with configuration files, or by code itself. I have created class to registered them, as: public class OracleDbConfiguration : DbConfiguration { public BaseDbConfiguration() { this.SetProviderServices("Oracle.ManagedDataAccess.Client", EFOracleProviderServices.Instance); this.SetProviderFactory("Oracle.ManagedDataAccess.Client", new OracleClientFactory()); } } Now you can use this class with the EF DbCotext class as: [DbConfigurationType(typeof(OracleDbConfiguration))] public class DataContext: DbContext { ... } Oracle Table Consider a simple D