Entity framework - DTO template - Enum type support

Entity framework - DTO template - Enum type support

Postby Hari » Tue 15 Jul 2014 15:46

Hi,

From Model First design, I am generating c# code using DTO template. The DTOs.cs has all classes except for EnumTypes. I can see them on edml. Other templates (like DBContext) are generating enums also. Does DTO template not support enum generation OR am I missing any template properties settings?

Thanks.
Hari
 
Posts: 1
Joined: Tue 15 Jul 2014 15:24

Re: Entity framework - DTO template - Enum type support

Postby MariiaI » Thu 17 Jul 2014 12:33

Hari wrote:From Model First design, I am generating c# code using DTO template. The DTOs.cs has all classes except for EnumTypes.
This is an expected behaviour.
The "Data Transfer Object" template is not the main, this is the auxiliary one. Thus, it doesn't generate main objects, including enums. We recommend you to add the DbContext template to your model, too. In this case, the DbContext class, entity classes and enums will be generated.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Entity framework - DTO template - Enum type support

Postby rmagruder » Thu 17 Jul 2014 13:26

I'm unclear by what you mean by 'auxiliary' vs. 'main'. Can you clarify the intent of the DTO template?
rmagruder
 
Posts: 47
Joined: Thu 26 Jun 2014 17:12

Re: Entity framework - DTO template - Enum type support

Postby MariiaI » Fri 18 Jul 2014 11:44

There are several templates for code generation available in Entity Developer. These templates are divided into groups:
- Data Access Level
- Domain Level
- Presentation Level
- Shared

Auxiliary means, that the DTO template is usualy used in addition to one of the general templates - DbContext, ObjectContext, POCO Entities, etc., which are made for Data Access Level. The DTO template doesn't generated Context class, entity classes, enums, etc.
This template generates both DTO classes and converter classes with extension methods for converting entities to DTO and vice versa. These converter classes are partial classes with partial methods that you can use to customize the conversion process. If generated converter classes are not suitable for you, you can disable their generation with the Generate Converters property and use some third-party library, for example, AutoMapper, to convert objects.
While the DbContext, or EntityObject, template generates strongly-typed DbContext (or ObjectContext) class and persistence ignorant entity classes, enum types, methods.

Please refer to the corresponding sections in the Entity Developer documentation:
- Template System Concepts
- ORM Support-> Entity Framework-> Concepts-> Model Generation Templates
JIC: Entity Developer documenatation is available with the installation package (the "Help" component should have been selected when installing).
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Entity framework - DTO template - Enum type support

Postby rmagruder » Fri 25 Jul 2014 15:39

Thank you for clarifying that. Appreciated.
rmagruder
 
Posts: 47
Joined: Thu 26 Jun 2014 17:12


Return to dotConnect for Oracle