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

Duplicated configuration classes when using EntityTypeConfiguration.t4 #2256

Closed
CyberbobGit opened this issue Apr 2, 2024 · 10 comments
Closed
Labels
question Further information is requested

Comments

@CyberbobGit
Copy link

Hello,
we have been using the Reverse Engineer option from EF Core Power Tools for a long time and we are satisfied with it. A few days ago we upgraded to the latest version and found that renaming properties via efpt.property-renaming.json is no longer supported, so we switched to the option to do it via T4. We also use "Split DbContext into Configuration classes" option which ensure that configuration classes are generated to separate folders. Unfortunately, since we started using EntityTypeConfiguration.t4, they are generated in Configurations folder as well as in the root project folder. This means that all classes are duplicated. Why does the generation via EntityTypeConfiguration.t4 not respect the settings and does not generate the configuration classes only to Configurations folders?

@ErikEJ
Copy link
Owner

ErikEJ commented Apr 2, 2024

Where did you get EntityTypeConfiguration.t4 from? It is not a file I am aware of

@CyberbobGit
Copy link
Author

I think I downloaded T4 from here. Can you please advise which one I should use? I will compare them.

@ErikEJ
Copy link
Owner

ErikEJ commented Apr 2, 2024

@ErikEJ
Copy link
Owner

ErikEJ commented Apr 2, 2024

I would just stick with the option in the tool and use the default templates for now (none of the templates linked to above) - or use the set of templates that I provide in my sample folder only.

@CyberbobGit
Copy link
Author

@CyberbobGit
Copy link
Author

I would just stick with the option in the tool and use the default templates for now (none of the templates linked to above) - or use the set of templates that I provide in my sample folder only.

Unfortunately it didn't work for me. I was able to rename properties in Model classes but they remained with the original name in Configuration classes.
Maybe I'm doing something wrong...

@ErikEJ
Copy link
Owner

ErikEJ commented Apr 2, 2024

Unfortunately it didn't work for me. I was able to rename properties in Model classes but they remained with the original name in Configuration classes.

Ah, of course! Then you can uncheck the built-in option I think.

@ErikEJ ErikEJ added the question Further information is requested label Apr 2, 2024
@CyberbobGit
Copy link
Author

Unfortunately it didn't work for me. I was able to rename properties in Model classes but they remained with the original name in Configuration classes.

Ah, of course! Then you can uncheck the built-in option I think.

It is not my problem. Build Action se set to None for all T4 files. I don't understand how can I affect property names generation in Configuration classes from EntityType.T4 file.

@ErikEJ
Copy link
Owner

ErikEJ commented Apr 2, 2024

I meant uncheck the; "Split DbContext into Configuration classes" option 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants