Configuring Oracle Database Access in EF7

asp.net asp.net-mvc entity-framework-core json oracle

Question

I'm following the Pluralsight course on Building a Web App with ASP.NET 5, MVC 6, EF7 and AngularJS and I'm having trouble configuring the Database connections to an exisiting Oracle Database.

The tool I'm using is Visual Studio Code, scaffolding by Yeoman and package dependencies by NuGet and Bower.

The tutorial assumes SqlServer is being used instead of Oracle, hence all the necessary configurations are aimed at it. I have looked EVERYWHERE for guidance, but sadly to no avail.

Right now my project.json file contains the following (trimmed):

"dependencies": {

  [...]

  "EntityFramework.Commands": "7.0.0-rc1-final",
  "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
  "EntityFramework.Oracle.Rdb": "7.3.4.0",
  "Oracle.ManagedDataAccess.EntityFramework": "12.1.2400",
  "OracleDbConnect": "1.0.0.0"
},

And my config.json contains the following:

"Data": {
        "WorldContextConnection" : "Server=;Database=TheWorldDb;Trusted_Connection=;MultipleActiveRecordSets=true"
    }

The tutorial specifies that the DataBase Context located in WorldContext.cs should contain a method overriding OnConfiguring as follows:

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        var connString = Startup.Configuration["Data:WorldContextConnection"];
        optionsBuilder.UseSqlServer(connString);
        base.OnConfiguring(optionsBuilder);
    }

And finally, adding the Entity Framework service in the startup.cs file:

public void ConfigureServices(IServiceCollection services)
{
    services.AddMvc();
    services.AddScoped<TheWorld.Services.IMailService, TheWorld.Services.DebugMailService>();
    services.AddEntityFramework()
    .AddSqlServer()
    .AddDbContext<WorldContext>();

}

I need using those dependencies I imported to the project.json to configure the Oracle service and allow the Web Application to store and retrieve information from an exisiting Oracle database.

Is this even possible?

Many thanks in advanced.

Accepted Answer

Currently there is no Oracle provider for EF7, the package you use are for EF6.

Current providers are listed here: http://docs.efproject.net/en/latest/providers/index.html - but I would expect more to appear around the RTM of EF7 in Q1 2016



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why