Comments (17)
Generally, generating DTOs directly from the database is not a good pattern, IMHO.
Are you referring to just the file names?
from efcorepowertools.
Yes, just the the file names.
I understand that that's not a best pattern. I'm trying to use it as a head start for my DTOs. Then use the nav properties as a reference to flatten and alter my DTOs manually.
Maybe this is a different scope or already doable through handlebars, but it would be great to use the template to go through the nav properties and generate composed name properties derived from themdirectly in the main class, like automapper does.
from efcorepowertools.
We found that handlebars are not as easy to modify especially for suffix, end up using GeCo (Generator Console) for that:
https://github.com/iQuarc/Geco
from efcorepowertools.
Can't this be added via the GUI interface, to add the suffix to the filename?
from efcorepowertools.
@yomer How would that affect the class Name? Or are you referring to just the file name?
from efcorepowertools.
It's just for the file name. The class Name, I can set it by modifying the handlebar templates. I was looking into adding a suffix for the sake of having the class Names and filenames with the same suffix.
I know that my request is a bit specific. Maybe someone else could eventually need to add either a prefix or a suffix to their classes.
A small reminder: I'm using EF CorePowerTools to generate my model for data access. And, since I would have to type in a lot of code to make my DTOs, my intention is to use this tool to generate suffixed classes (and filenames) which then I will alter to end up with said DTOs.
from efcorepowertools.
I made an issue about this but I closed it since this already exist. I also would like to see something exactly the same as what the OP is requesting. Being able to add suffix to filename only. This was my message:
I think it would be a good idea to implement a way we can add prefix/suffix to generated classes from table. Let's say we have a "Blogs" table. When I run the power tool, it'll generate "Blog" class. However, in my project I already have a "Blog" class as well. Sure, I can easily reference the correct namespace and do ToPOCO conversion. However, it'll be much easier to differentiate if I could add suffix to my generated class name, something like "BlogDTO" or "BlogEF". Maybe an option, where we can pick the generated classnaming? E.g. "{class}DTO". My closed issue: #75
from efcorepowertools.
Any update on this? It's a big help because you can have 3 different types of class with the same name. For example, Blogs (local class), Blogs (Database/EF Class), and Blogs (DTO Class). So if we can add a suffix like "BlogsDBO", it can help in differentiating which class we are looking for. It's hard to do this manually when you might have over 100 classes generated by EF PowerTools
from efcorepowertools.
@refx32 You could put the files in different name spaces and/or projects - having them all in the same folder seems like a wrong pattern
from efcorepowertools.
@ErikEJ Yes, of course. That is exactly how we have it (Different folders, different projects). But now imagine I'm making a new file, and I'm calling "Blogs" class. When I press "CTRL + ." to generate the namespace, I have to pick between the 3 namespace (.DTO, .DBO, or .Model).
Even worse, let's say I'm debugging old files, at the first glance, I don't know which "Blogs" it is. I have to hover over to see the proper namespace of "Blogs". Vs. if it was "BlogsDTO" or "BlogsDBO", I know exactly what it is just by a quick glance.
from efcorepowertools.
@refx32 Some users in this thread are referring to just the file names, but if I understand you correctly, you are referring to the class names - so there are two issues here? Or am I misunderstanding?
from efcorepowertools.
Modifying the file names is just a question about getting the required input about what to do, and the modify the code here: https://github.com/ErikEJ/EFCorePowerTools/blob/master/src/GUI/EFCorePowerTools/Handlers/ReverseEngineerHandler.cs#L186
from efcorepowertools.
Sorry, I was not aware people were referring to file names. Why have a file name different than class name though? If they create a file name like "BlogsDTO.cs", why have a class name like "Blogs" inside it? This does not feel clean to me.
One of the suggestion was having a "Suffix/Prefix input" when the option pops up. It could be "{tableName}" by default, and if we want to add any suffix/prefix to it, we can change it to something like "{tableName}DBO", which will generate "Blogs" table name as "BlogsDBO". Once again, just a suggestion.
from efcorepowertools.
@refx32 I think this feature will be able to help you: #128 (comment)
from efcorepowertools.
So that is kind of like a configuration file? We have over 100 tables at our work, is there a way I can define every class we generate, we want it named {tableName}DBO on that file?
from efcorepowertools.
How you create and maintain the file is entirely up to you and your imagination.
from efcorepowertools.
I accomplished OP's request here: TrackableEntities/EntityFrameworkCore.Scaffolding.Handlebars#34 (comment)
from efcorepowertools.
Related Issues (20)
- throw new NotSupportedException("This method can only be called from Entity Framework Core queries"); as the definition of a HOT 1
- Add Generate ER Diagram to Project context menu (support for .dacpac)
- [Feature] Add "Analyze this!" to database projects / MsBuild.SDK.SqlProj context menu
- SQL Server table valued functions disappeared HOT 4
- DRY FunctionScaffolder and ProcedureScaffolder
- Hi Erik, While I'm trying to access the Reverse Engineer ... HOT 4
- Table Valued Parameters in Stored Procedures from a .dacpac HOT 23
- Inappropriate Navigation Property name generated by EF Core reverse engg. HOT 5
- Inappropriate Navigation Property name generated by EF Core reverse engg. HOT 9
- [Question] How to disable generation of readme in EF Core Power Tools CLI ? HOT 3
- Analyse this! from a live database (experimental)
- Sync localized vsct files
- Support for Many-to-many and join table with payload HOT 2
- Ability to use migrations tool without providing a connection string HOT 6
- Latest update fails to load. HOT 17
- Check synapse host name detection
- Unable to reverse engineer because it cannot find data provider HOT 1
- [Feature] Map simple postgress stored procedures
- Add script generation to migrations tool HOT 6
- [Question] Compare DbContext to Database Using CLI HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from efcorepowertools.