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!

.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

Colm Divilly-Oracle
Answer

A1: Yes that's fine, you can delete the bdb/ folder and it's sub-folders, see below.

A2: These are transient storage files used by the Berkeley DB engine, which Listener uses internally. Each startup of Listener (since 2.0.2) creates a new temp folder under the bdb folder to store it's transient data. Also when starting up Listener will attempt to clean up any existing folders under bdb, that do not have an open file within.

Previously in 2.0.1 and earlier all BDB files were stored directly in the bdb folder. This causes complications when attempting to run Listener in a clustered environment. If all the nodes shared the same configuration folder, then only the first node started in the cluster would work, because BDB needs an exclusive lock to it's data files, the first node would get this, and then the all other nodes would fail to obtain the lock and become non functional.

So if you were using Listener 2.0.1 or earlier in a clustered environment the advice was to give each node its own configuration folder to avoid this problem.

Now since Listener 2.0.2 the best practice is the opposite, if you are running listener in a clustered environment and all nodes connect to the same database(s) then each node should point to the same configuration folder (e.g an NFS folder share, with write access). This gives the advantage of it being easier to maintain consistent configuration across all nodes.

Marked as Answer by MSK · Sep 27 2020
1 - 1

Post Details

Added on Apr 24 2019
10 comments
1,623 views