Page 1 of 1

DTO converter with Automapper

Posted: Sun 29 Jan 2017 15:24
by dambsst
Hello,
I am trying Entity Developer and when I investigate the files generated by the DTO converter, I notice that in the function "ToEntity()" the navigations properties are not updated. There should be a way to update them using Automapper and a reference to the target dbcontext so that it can map by itself an INT (foreign key) to an entity? Or there is sth wrong in my idea?
Also in the DTO generator, it is not possible to select only the navigations with 0 or 1 endings , the settings "ClassesInAssociations" allows to show only the navigations with * endings and hides the others, but no the opposite. OMHO the opposite is more useful.

Best Regards, Damien

Re: DTO converter with Automapper

Posted: Mon 30 Jan 2017 17:51
by Shalex
dambsst wrote:I am trying Entity Developer and when I investigate the files generated by the DTO converter, I notice that in the function "ToEntity()" the navigations properties are not updated. There should be a way to update them using Automapper and a reference to the target dbcontext so that it can map by itself an INT (foreign key) to an entity? Or there is sth wrong in my idea?
We recommend you to edit a predefined Data Transfer Object template to adjust it for your task. Refer to the Entity Developer documentation: http://www.devart.com/entitydeveloper/e ... eloper.chm (download, right click > Properties > Unblock), the Template System Concepts section.
dambsst wrote:Also in the DTO generator, it is not possible to select only the navigations with 0 or 1 endings , the settings "ClassesInAssociations" allows to show only the navigations with * endings and hides the others, but no the opposite. OMHO the opposite is more useful.
Here is a definition of the DTO Classes In Associations property in the Data Transfer Object template:
  • If it is set to True, navigation properties for DTO classes are generated on any association end. These properties are generated as single DTO Objects (for a (0..1) or (1) association end) or collections of DTO objects (for a (*) association end).
  • If it is set to False, the navigation properties for DTO classes are generated only for (*) association ends.
  • If the dependent class has a simple primary key that consists of a single property, the navigation property is a collection of primitive type elements (for example, List<Int32>), which are the primary key values of the dependent class. If the primary key of the dependent class consists of several properties, the navigation property is a collection of new DTO class objects (for example, List<OtherClassKeyDto>), that contain only the primary key properties of the dependent class. If the dependent class does not have a primary key, the navigation property is a collection of the existing DTO class (for example, List<OtherClassDto>).

Re: DTO converter with Automapper

Posted: Sun 12 Mar 2017 13:27
by dambsst
Hello,

I just want to thank you for your answer, and sorry for my late reply.

Yes in the meantime I have edited the templates so I can generate models, dto, business object etc.... it's perfect.

I really like your software, my trial has expired and I guess I will purchase it soon when I restart working on this project.

Thanks again,

Re: DTO converter with Automapper

Posted: Mon 13 Mar 2017 08:38
by Shalex
Thank you for your feedback.