-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
T4 template to exclude from the generated code database artifacts not used by EF Core at runtime #10890
Comments
Update from Database may benefit from having the constraint names. |
Great info, thanks Brice |
See #12837 (comment) for some possible reservations... Out of curiosity, have people actually been complaining about this? Is it really that hard to just remove the unwanted stuff from your model manually? I guess I put a high bar on extra command-line switches... |
@roji Not disagreeing with you, but two things play the other way:
|
I use that workflow in production and it is actually not so bad... |
@ErikEJ Good to hear! Including the manual edits? How much manual editing do you do, and how often does the database need to be re-scaffolded? |
We dont do any manual edits. We use partial DbContext and Entity Classes, and each developer re-scaffolds on each schema change (we use SSDT project for the schema, so generate directly from the dacpac via EFPT, but might as well be from a local scratch database) |
My comment on the docs page got merged into this issue. |
I put together a sample in bricelam/EFCore.TextTemplating showing how to use T4 templates to customize the code scaffolded by Scaffold-DbContext (and |
@bricelam, I took a look at your project for templating and it seems like just what the doctor ordered. A whole lot to learn, since I've never used the T4 templates, but seems like a great time to learn. Thanks for putting that together! |
Note: this will be possible once #4038 is implemented, which is planned for 7.0, and is already possible with the Power Tools. |
The following are currently unused by the runtime (outside of Migrations) and can be safely removed from the scaffolded code:
The text was updated successfully, but these errors were encountered: