[Feature] Choose DTO properties to generate


Thanks to @sizilium who have suggested the following:

"A feature in your tool to choose what properties goes into a DTO would be great! Because normally you only want to transfer really needed properties through DTO's and not the whole bunch of informations which are propably not needed (because performance and design reasons).
It would be also useful to store these kind of mapping informations in the configuration file, so that I can store it in version control system for example. In case of refactoring the mapping should be updated automatically (when possible)."

file attachments


aylwyn wrote Feb 7, 2013 at 3:37 AM

Hi there

I just wanted to back up @sizilium's feature request and offer an enhancement.

Quite often we'll employ different domain models based off the same entity dependent on the domain's use case. That means we may have the same enitity, Customer, but depending on whether the entity is being used by a customer service operator or an accounts person, each domain object will have different properties due to different responsibilities.

This leads to the request for the enhancement - being able to specify multiple drop locations for individual DTO's (e.g. Solution.Core.Accounts.DTO or Solution.Core.CRM.DTO) whilst still incorporating @sizilium's request that individual properties being able to be configured as required.

Not to teach you to suck eggs, but one possible way I see this working which might reduce your complexity, would be to alter the DTO's target pane to accept multiple selection rather than just a single selection (e.g. checkbox). I threw together a quick screenshot / example for clarification.

ffernandez wrote Feb 7, 2013 at 12:03 PM

Hi @aylwyn
Thanks for your feedback.
The feature you are proposing could be trated as a separate one I think, anyway it is good indeed.
What I can suggest while this is not possible is to have multiple EntitiesToDTOs configuration files, so you first generate DTOs using one and then using the other.
I will create a new work item for this later.
Thanks again!

aylwyn wrote Feb 7, 2013 at 7:03 PM

Please post the link to the new worksite so I can track. I think you don't need more than one config file, just that the config file would have multiple extra nodes...

aylwyn wrote Feb 7, 2013 at 7:04 PM

Autocorrect.... Grrr... I mean workitem. :)

ffernandez wrote Feb 8, 2013 at 3:00 AM

yep, I get the multiple nodes approach, I just was suggesting that after this feature gets implemented (optional DTO properties) the one you are sugesting can be addressed using the Config:Export/Import functionality with multiple EntitiesToDTOs configuration files, so you end up with one EntitiesToDTOs configuration file to generate DTOs for Solution.Core.Accounts.DTO and another EntitiesToDTOs configuration file to generate DTOs for Solution.Core.CRM.DTO .

I do believe like you that having the option to generate both at the same time is could be much more usable but until then, that solution could work.

Let me know what you think.

This is the work item to track your suggestion ;)


wrote Feb 8, 2013 at 3:03 AM

wrote Feb 22, 2013 at 12:03 AM

ffernandez wrote Mar 15, 2013 at 6:33 PM

Navigation properties must be optional too as suggested here.

wrote Jul 9, 2013 at 4:24 PM

karmaedv wrote Jul 9, 2013 at 4:24 PM

Also, a Checkbox Option to remove just the Ids and Foreign Keys from the DTOs would be nice.

wrote Jul 23, 2013 at 8:11 PM

wrote Oct 7, 2013 at 5:55 PM