Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

.net entity framework core public beta

user5716448Apr 24 2019 — edited Apr 29 2019

Hi,

Using tutorial to look to build a .net core crud usinfg oracle

Have followed the steps at https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/?view=aspnetcore-2.2 and wokr so.k with local sql server database.

However, want  to use oracle database as source

Have tried putting below in the context.cs and chnaged the usesqlserver to use oracle in the startup.cs

services.AddDbContext<RazorPagesMultipleContext>(options =>

                 //  options.UseSqlServer(Configuration.GetConnectionString("RazorPagesContext")));

                   options.UseOracle(Configuration.GetConnectionString("RazorPagesContext")));

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)

        {

            optionsBuilder.UseOracle(@"User Id = <userid>; Password = <pwd>; Data Source = <server>:1521/<SID>;");

        }

but get message below

Severity Code Description Project File Line Suppression State

Error CS0121 The call is ambiguous between the following methods or properties: 'Microsoft.EntityFrameworkCore.OracleDbContextOptionsExtensions.UseOracle(Microsoft.EntityFrameworkCore.DbContextOptionsBuilder, string, System.Action<Oracle.EntityFrameworkCore.Infrastructure.OracleDbContextOptionsBuilder>)' and 'Microsoft.EntityFrameworkCore.OracleDbContextOptionsBuilderExtensions.UseOracle(Microsoft.EntityFrameworkCore.DbContextOptionsBuilder, string, System.Action<Devart.Data.Oracle.Entity.OracleDbContextOptionsBuilder>)' RazorPages D:\razorpages\RazorPages\RazorPages\Data\RazorPagesContext.cs 35 Active

Looking at

https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/sql?view=aspnetcore-2.2&tabs=visual-studio suggest can put connection string in the appsettings.json file

shows sqlserver example

RazorPagesMovieContext": "Server=(localdb)\\mssqllocaldb;Database=RazorPagesMovieContext-1234;Trusted_Connection=True;MultipleActiveResultSets=true"

How can we change this to use Oracle and what is causing ambiguity above?  Have

using Oracle.EntityFrameworkCore;

using Microsoft.EntityFrameworkCore; included in startup.cs and imported the ef core beta 3 for oracle ef core and 

looking ideally to get above working with oracle and any other examples of standard guid cru with ef core and oracle.

Thanks

Comments

Post Details

Added on Apr 24 2019
10 comments
1,413 views