Have you been looking for a solution to connect Entity Framework and Oracle? In this blog post, I will show how to integrate Entity Framework 6 with Oracle database, through a step by step implementation.

Let’s begin.

Start a new project

Before adding a new project, you need to install ODP.NET and ODAC from here. Install 64-bit ODAC 12c Release 3 (12.1.0.2.1) for Windows x64. This will work for visual studio 2013.

After installing, run the setup once and restart your system. Then follow the below steps:

    1.  Open Visual Studio 2013 and add a project.

    1. Add Entity Data Model by right clicking on the project in the solution explorer – Add -> click New Item and select ADO.NET Entity Data Model from the popup. Click Add button.

    1. Entity Data Model Wizard opens with four options to select. We will focus on the database-first approach, so select EF Designer from database option and click Next.

    1. You can choose from your existing DB Connections or create a new connection by clicking the New Connection button. This will also add a connection string to your app.config file with default suffix as database name. Click Next after you set up your database connection.

    1. Now when you will click on Next, it will give an error as below:

    1. To resolve this error, we need to add Oracle 12c version by NuGet packages and search oracle. Right click on Project ->Manage Nuget Packages ->Browse for Oracle then add the following.

    1. After installing the oracle 12c, the above error is resolved. Then you can add the entity framework and include all the tables as desired.

    1. After clicking on Finish, an edmx file will be added into your project. EDM also adds a connection string in the app.config file.

Conclusion

Configuring Entity Framework 6 to work with Oracle database is now doable. In earlier versions, Nuget Manager Installation was not available, but now it is available and working successfully. In in my next blog, I will be talking about Entity framework configuration management and deployment with Oracle database. Stay tuned for more.

Posted by Advaiya

    Let's connect to make technology work for you.





    Please tick the options most relevant to your business challenges
    Decision makingBusiness productivityCustomer experienceTechnology-led innovationDigital transformation


    [By using this form you agree with the storage and handling of your data by this website.]