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

Class modifiers on non-T4/Handlebars items (specifically sprocs) #2741

Open
jwyza-pi opened this issue Dec 17, 2024 · 6 comments
Open

Class modifiers on non-T4/Handlebars items (specifically sprocs) #2741

jwyza-pi opened this issue Dec 17, 2024 · 6 comments
Labels

Comments

@jwyza-pi
Copy link
Contributor

I know in previous issue requests, that folks have requested the ability to change the class access modifiers for the stored procedures. The answer currently stands as making that a post-scaffolding operation. Now that we have complete control over the EntityTypeConfigurations through the T4 templates, this is one of the last remaining places that we can't customize.

Would you be open to a enhancement PR that would add (at the very least) a setting for the class access modifiers for the related classes generated for stored procedures as an option to the CLI? I wouldn't be able to easily do the GUI side of it, but could handle getting all the code in place so that it works for the CLI (which if I understand how the GUI works, it's mostly just hooking the GUI itself up as both share the same underlying code to do the actual generation).

If you are open to it, I'll see what it would take to accomplish, if not, that's OK too. I understand that it adds overhead to the application that you have to maintain going forward.

(Honestly, long term I'd be great to have T4 & handlebars templates for everything, but that's a substantially heavier lift).

Provide technical details

  • EF Core Power Tools version: 8.1.624+2406c890c03798082722e1f757e32be8f82d5bb4

  • Exact Visual Studio version: N/A

  • Database engine: Azure SQL

  • EF Core version in use: EFC8

  • Is Handlebars templates used: no

  • Is T4 templates used: yes

  • Is a SQL Server .dacpac used: no

@jwyza-pi jwyza-pi changed the title Class modifiers on non-T4/Handlebars items Class modifiers on non-T4/Handlebars items (specifically sprocs) Dec 17, 2024
@ErikEJ
Copy link
Owner

ErikEJ commented Dec 17, 2024

Sure, I think it will be not so hard to do, just stick to the CLI implementation. I assume you are referring to the result set classes for "routines"?

@jwyza-pi
Copy link
Contributor Author

It's the [DbContextName]Procedures (partial class of [DbContextName]), I[DbContextName]Procedures, DbContextExtensions, and OutputParameter<TValue> classes that all would need to follow whatever the access modifier is.

Not sure if the extensions and outputparameter classes are used by the Functions output, if they are, then those would also probably need to have the same treatment.

@ErikEJ
Copy link
Owner

ErikEJ commented Dec 17, 2024

Ouch! DbContextExtensions, and OutputParameter<TValue> are going to be tricky! Maybe they can just be included in the [DbContextName]Procedures class?

@jwyza-pi
Copy link
Contributor Author

It's surely possible, but I'm worried about that breaking folks downstream since the namespace of those classes would then change :(.

I take it those 2 classes are used much more than just the sprocs?

@ErikEJ
Copy link
Owner

ErikEJ commented Dec 17, 2024

I think they are only used by the sprocs, so they could be generated, or you could add a replacement tag for the modifier?

@jwyza-pi
Copy link
Contributor Author

Yeah. just like #NAMESPACE# is currently done for it.

And then updating the procedureScaffolder base class to use the access modifier when writing out the context files.

So I think it's updating ProcedureScaffolder, PostgressStoredProcedureScaffolder and SqlServerStoredProcedureScaffolder. (along with the files needed for setting itself).

@ErikEJ ErikEJ added enhancement New feature or request reveng reveng-cli labels Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants