Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Support Stored Procedures and Functions for other providers #697

Open
pgkdev opened this issue Jan 4, 2021 · 26 comments
Open
Labels
enhancement New feature or request help wanted Extra attention is needed reveng reveng-cli
Milestone

Comments

@pgkdev
Copy link

pgkdev commented Jan 4, 2021

Tested EF Core Power Tools to reverse engineer an Oracle Database, I was able to create models for tables and views but not for Stored Procedures included in Oracle Packages.

Steps to reproduce

Create Oracle Database with a Package and a Stored procedure.
Using EF Core Power Tools, try to reverse engineer to create model for Stored Procedure inputs and outputs.
(Maybe it only supports SQL Server SPs for now, like shown in project pages, but Oracle support for SPs will be implemented soon? Need it, thanks :)

Further technical details

EF Core Power Tools version: 5.2.406

Database engine: Oracle XE 184 Win64

Visual Studio version: (e.g. Visual Studio 2019 16.8.3)

@ErikEJ
Copy link
Owner

ErikEJ commented Jan 4, 2021

Not something I plan to implement, as I no nothing about Oracle, and had no test server.

But a PR would be welcome, if you want to do that, I can provide more implementation details.

Code for Postgres stored proc discovery:

https://github.com/vb-consulting/NpgsqlRest/blob/master/NpgsqlRest/RoutineSourceQuery.cs

@pgkdev
Copy link
Author

pgkdev commented Jan 4, 2021

Unfortunately I don't have the time and the knowledge to implement a complicated piece of software like this.

I was liking so much this tool, it seem perfect but then notice this missing feature for Oracle, and I have lots of SPs :s
Do you have some alternative solution for this?

Thanks and great project "EF Core Power Tools".

@ErikEJ
Copy link
Owner

ErikEJ commented Jan 4, 2021

It is actually not that complicated. But maybe someone else can step up @ProH4Ck ?

@ProH4Ck
Copy link
Contributor

ProH4Ck commented Jan 4, 2021

Ok... I'll check in the next few days if this is possible but I remember that something is not yet implemented in Oracle EF Core provider (UDTs for example)...
I need to check if basic stored procedures work and if they'll work, I'll add support to EF Core Power Tools.

@ErikEJ
Copy link
Owner

ErikEJ commented Jan 4, 2021

Fantastic! Feel free to ask me for implementation suggestions/advice.

@ErikEJ ErikEJ changed the title Issue/Proposal: Support Oracle Packages and Stored Procedures reverse engineer Proposal: Support Oracle Packages and Stored Procedures reverse engineer Jan 7, 2021
@ErikEJ ErikEJ added enhancement New feature or request reveng labels Jan 7, 2021
@Giorgi
Copy link

Giorgi commented Jan 14, 2021

In Oracle, it is common to group stored procedures and functions in packages. In the project that I had to deal with Oracle, I had a separate static class for each Oracle package that contained an extension method on DbContext for every sproc/function found in that package.

I can help with adding support for Oracle too.

@ErikEJ
Copy link
Owner

ErikEJ commented Jan 14, 2021

I would prefer an implementation that resembles the SQL Server implementation as closely as possible

@Giorgi
Copy link

Giorgi commented Jan 14, 2021

How do you deal with sprocs that have the same name but have different schema?

@ErikEJ
Copy link
Owner

ErikEJ commented Jan 14, 2021

Specify the schema name when calling them...

But I think schema may mean something completely different in Oracle

@Giorgi
Copy link

Giorgi commented Jan 14, 2021

Yes, the schema is a different thing in Oracle. In Oracle, you can have sprocs with the same name but in different packages. Specifying the package name every time you call a sproc means having to type it manually, but we can have it generated by grouping the sprocs in separate classes instead of having one giant class holding all sprocs/functions.

@ErikEJ
Copy link
Owner

ErikEJ commented Jan 14, 2021

Ah, I think I get your question now. I name the method SchemaMethodName if there are duplicates.

Have a look at the current implementation.

@Giorgi
Copy link

Giorgi commented Jan 14, 2021

I see. Well, I would prefer to have

var procedures = new NorthwindContextProcedures(db);
procedures.SchemaName.SprocName(param1, "param2");

But I guess it's too late to change? It would align with how you execute them in the database and would help clean up intellisense too.

Also, what do you think about returning a named tuple when the sproc has multiple output parameters instead of using OutputParameter?

@ErikEJ
Copy link
Owner

ErikEJ commented Jan 14, 2021

It is actually SprocnameSchemaname.

Tuples would be a breaking change as well, and changing the API is also not what this feature is about.

@pgkdev pgkdev closed this as completed Jan 15, 2021
@pgkdev
Copy link
Author

pgkdev commented Jan 15, 2021

In Oracle, it is common to group stored procedures and functions in packages. In the project that I had to deal with Oracle, I had a separate static class for each Oracle package that contained an extension method on DbContext for every sproc/function found in that package.

I can help with adding support for Oracle too.

I can confirm this, we have Procedures and Functions in packages.

@ErikEJ ErikEJ reopened this Jan 15, 2021
@ErikEJ
Copy link
Owner

ErikEJ commented Jan 15, 2021

@pgkdev why was this closed?

@ErikEJ
Copy link
Owner

ErikEJ commented Jan 16, 2021

I think you must try to implement something, or explain with examples, my Oracle knowledge is zero.

@pgkdev
Copy link
Author

pgkdev commented Jan 18, 2021

@pgkdev why was this closed?

It was a click mistake, sorry :s

@pgkdev
Copy link
Author

pgkdev commented Jan 18, 2021

I think you must try to implement something, or explain with examples, my Oracle knowledge is zero.

It's +- like me, I'm using what other IT team provided for Oracle DB schema. But noticed that, stored procedures inside packages.

@pgkdev
Copy link
Author

pgkdev commented Jan 27, 2021

@ProH4Ck any news on the implementation?
Need that :)

@ErikEJ ErikEJ changed the title Proposal: Support Oracle Packages and Stored Procedures reverse engineer Support Stored Procedures reverse engineering for other providers (Oracle, Sybase) Apr 10, 2021
@ErikEJ ErikEJ changed the title Support Stored Procedures reverse engineering for other providers (Oracle, Sybase) Support Stored Procedures reverse engineering for other providers (Oracle, MySQL, Postgress) Apr 10, 2021
@ErikEJ ErikEJ changed the title Support Stored Procedures reverse engineering for other providers (Oracle, MySQL, Postgress) Support Stored Procedures and Functions for other providers (Oracle, MySQL, Postgress) Apr 10, 2021
@ErikEJ ErikEJ changed the title Support Stored Procedures and Functions for other providers (Oracle, MySQL, Postgress) Support Stored Procedures and Functions for other providers (Oracle, MySQL, PostgreSQL) Apr 10, 2021
@ErikEJ ErikEJ changed the title Support Stored Procedures and Functions for other providers (Oracle, MySQL, PostgreSQL) Support Stored Procedures and Functions for other providers (Oracle, MySQL, PostgreSQL, Firebird) Sep 1, 2021
@kevinvenclovas
Copy link

Is someone working on this issue? I need this for my projekt now otherway i need to use a other framework/tool

@ErikEJ
Copy link
Owner

ErikEJ commented Sep 1, 2021

No, this issue needs help from experts in the various RDBMS systems.

@kevinvenclovas
Copy link

Oke thanks. Is there a workaround?
Is there a option to execute a raw sql string to execute my procedur?

@ErikEJ
Copy link
Owner

ErikEJ commented Sep 1, 2021

Sure, you can just hand code what the stored procedure mapping does (run against a SQL Server db, or see the code in the GitHub repo ( in the ScaffoldingTester project)

@ErikEJ
Copy link
Owner

ErikEJ commented Nov 22, 2021

Closing and moving to Backlog milestone

@ErikEJ ErikEJ closed this as completed Nov 22, 2021
@ErikEJ ErikEJ added this to the Backlog milestone Nov 23, 2021
@ErikEJ ErikEJ reopened this Dec 29, 2022
@andrewdci03
Copy link

@ErikEJ you mentioned not implementing because of no knowledge of Oracle, is this the same for MySQL? My team is trying to reverse engineer the stored procedures in our MySQL Database, but it seems this doesn't support that yet.

@ErikEJ
Copy link
Owner

ErikEJ commented Apr 14, 2023

@andrewdci03 Correct, only SQL Server / Azure SQL stored procedures are supported, but I am willing to help anyone with a PR

@ErikEJ ErikEJ added the help wanted Extra attention is needed label Feb 1, 2024
@ErikEJ ErikEJ changed the title Support Stored Procedures and Functions for other providers (Oracle, MySQL, PostgreSQL, Firebird) [Feature] Support Stored Procedures and Functions for other providers Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed reveng reveng-cli
Projects
None yet
Development

No branches or pull requests

6 participants