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