How to generate model classes for existing oracle database in asp core 2.2? - oracle

I'm trying to make database first approach in asp core 2.2.
My problem is that I can't find anything helpful to generate my model classes from my existing oracle database, I want to do it by anyway I don't care, but all my attempts failed so any help would be much appreciated
Edit 1:
I see that EF Core is always mentioned in the answer but it has no provider, I'm not sticking to it I'm really asking for any approach to do what I want so if there is a way with Dapper, NHibernate or anything else I will be happy to use it as it get the job done.
Edit 2:
I tried Devart.Data.Oracle.EFCore, it generates classes based on database tables like a charm but it's paid unfortunately. later I used Dapper and had to create classes on my own.

Seems like Oracle is currently conducting a private beta of their EF Core provider. You could either try to join the beta or keep waiting for the release of the public beta, which is announced for Dec., 2018 (seems to be delayed).
A documentation about reverse-engineering yor db can be found here.

There are several tools in the market
Devart's Entity Developer
Scaffold-DbContext or dotnet ef dbcontext scaffold
EF Core Power Tools
Edit
Right now, Oracle does not have support for Entity Framework Core. Which means you need to use third party library in order to use Entity Framework Core with Oracle.
Devart has dotConnect for Oracle Database Driver (adapter) which supports EF Core.
Please see this link for Future Plans about Oracle Database Providers
Edit: OP Stated that Only Mapping/Scaffolding will be enough
You may consider to use Entity Framework to scaffold your model and migrate it to EF Core Manually.You may need little tweaks since two framework has some differences.

Try using this provider https://github.com/CrazyJson/Citms.EntityFrameworkCore.Oracle
You can download it from NuGet-solution - Citms.EntityFrameworkCore.Oracle
Make sure you've installed its dependencies:
Oracle.ManagedDataAccess.Core (>= 2.18.3)
Microsoft.EntityFrameworkCore.Relational (>= 2.2.0)

For anyone who is coming in later, this was finally solved by oracle itself as they released their provider for EF core Oracle.EntityFrameworkCore.
Then follow the docs but use Oracle.EntityFrameworkCore and the proper connection string

Related

Couldn't find the Oracle Data source in visual studio 2012 while adding the ado.net Entity Model

This is my first time with MVC. When I am trying to add an ADO.net entity model then while creating a new connection I couldn't see my oracle database in the list of data source name. Only different type of Microsoft server is listed. What should I do to get the oracle database listed there too. When using simple database connection in the desktop application I could see the oracle database listed but not in this case.
The main problem is I couldn't connect entity data model to oracle database
I think you need to install the Oracle Developer Tools, which is a surprisingly complicated process.
This is a rather old article, but I think this is still useful
http://blogs.msdn.com/b/kaevans/archive/2009/07/18/connecting-to-oracle-from-visual-studio.aspx

Cannot get Entity Framework 5 and Power Tools to work correctly with Oracle 11g

I know this question is similar to another one, but I have now tried both the Oracle data provider and the Devart (dotConnect) provider, and cannot get either combination to work well with our Oracle 11g database and the Power Tools "reverse engineer code first" feature.
With the Oracle provider, there was no way to specify a schema or subset of the database, and it cranked out almost 3,000 entity classes, even though the connection was specific to the target application. It grabbed all the Oracle system tables, etc., along with the application data tables.
With the Devart provider, I still could not specify WHAT to generate, and ended up having to kill it off after running for almost a day.
Anyone know how to get this stuff working with Oracle?
We have answered you about dotConnect for Oracle (Entity Developer) at http://forums.devart.com/viewtopic.php?f=1&t=27520.

Using Oracle database with CakePHP 2.0

I have noticed there's no datasource for Oracle in CakePHP 2.0 for the moment, although it seems they are working on in it now: http://ask.cakephp.org/questions/view/any_news_about_oracle_datasource_with_cakephp_2_0
There are some people explaining how to use an Oracle DB adapting some code from CakePHP 1.3:
http://www.hassanbakar.com/2012/01/09/using-oracle-in-cakephp-2-0/
http://liamgraham.wordpress.com/2007/04/19/using-oracle-with-cakephp-15-minute-blog-tutorial/
But I'm not sure that's the correct way. If it was so simple, they would have released the feature already for CakePHP 2.X...
Would I have any trouble using that "cheat"?
I want to connect CakePHP with PL/SQL procedures and a desktop application and they are working over Oracle. I can not change that.
After asking some CakePHP developers I came out with the conclusion that it is not possible to use an Oracle Database with CakePHP 2.3 if you want to make a proper use of CakePHP Models and their query syntax. There's no yet available any driver for Oracle in CakePHP which is completely functional.
Therefore, the solution I found was to use the OCI8 Functions of PHP.
Like this i could use oci_parse to directly query against the DB or rather call a PL-SQL procedure which is what I finally decided to do. (because of the sql functions complexity and the division of task inside my work group)
Now, I can not make use of many of the advantages of using CakePHP models, but It was the only way.
There is a new CakePHP 3 Driver for Oracle Database released (MIT) and working with Oracle 11g and Oracle 12c databases. Some features:
Triggers
Sequences
Cursors
Stored procedures
Packages
All the basic CRUD features to allow select/insert/update/delete rows.
CakePHP Pagination
CakePHP Bake code generation
Check the Documentation here, and the release announcement here.

Mvc MiniProfiler WrappedConnection Property

How could I get the value from the WrappedCOnnection Property of a ProfiledDbCOnnection?
I know the property exists however its modifier does not allow me to get it during my development;
I need to get the underlying connection for I need to involve Entity framework in the same transaction a procedure call will be involved (because Entity framework does not allow me mapping this stored procedure on it)
I am using Oracle database, and the wrapped connection is a Devart Connection.
I was using MvcMiniProfiler 1.7. Now in MvcMiniProfiler 1.9 the property WrappedConnection was made public.
It is important to notice that probably if you are using Entity Framework together with MvcMiniprofiler, your app may fail compiling, just as happened to me, and the solution was found here:
Mini profiler upgrade from 1.7 to 1.9 breaks existing code

Entity framework join to ms-access

I want to ask you is any way to generate or updating access database from entity framework, I have a serious problem I have a database using ms-access and it is expensive for me if I want to change to sql server ?
I need to use entity framework functionality. could you give me a solution ?
If you want to use MSAccess don't use EF. If you want use EF, don't use MSAccess.
Entity Framework does not support Access. But you can migrate to SQL Express (at no cost) and use EF for your applications.
SQL Express is free and enought for small databases.
Alternatively, if you want a desktop database, you can use SQLite. NET driver for sqlite supports EF.

Resources