How to: add display-name and documentation for Enum members

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
mindplay
Posts: 148
Joined: Tue 13 Dec 2011 22:58
Location: Ithaca, NY

How to: add display-name and documentation for Enum members

Post by mindplay » Tue 20 Dec 2011 15:28

I found that enum type-members are incomplete without a display-name and documentation - I wanted the following output:

Code: Select all

    /// 
    /// This is my type
    /// 
    public enum Test : int
 {


    /// 
    /// Value A
    /// 
        [Display(Name="The First Value")]
        A = 1,

    /// 
    /// Value B
    /// 
        [Display(Name="The Second Value")]
        B = 2,

    /// 
    /// This is the third value
    /// 
        [Display(Name="The Third Value")]
        C = 3
    }
Go to Model Settings -> Extended Properties -> EnumTypeMember and add the following two properties:
  • DisplayName : System.String
    Documentation : System.String
Near the top of your template, add the following:

Code: Select all



Near line 480, copy/paste from the following snippet of code:

Code: Select all

     // enum type members
    if (enumType.Members.Count > 0) {
      foreach (EnumTypeMember member in enumType.Members) {
#>


        [Display(Name="")]

<# // --- COPY TO HERE ---
    if (GenerateDataContracts && (bool)member.GetProperty("GenerateEnumMemberAttribute")) {
Copy the range between the two comments - the lines before/after that are just there to show you where it fits into the standard template.

Hope this is useful to others :-)

mindplay
Posts: 148
Joined: Tue 13 Dec 2011 22:58
Location: Ithaca, NY

Post by mindplay » Tue 20 Dec 2011 15:30

PS: the indentation is a bit wonky - for some reason doing output.Indent++ before calling GenerateDocumentation() doesn't seem to work...

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 23 Dec 2011 09:38

Thank you for posting. We will fix the "add display-name and documentation for Enum members" and "output.Indent++" issues.

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 23 Dec 2011 14:23

mindplay wrote:PS: the indentation is a bit wonky - for some reason doing output.Indent++ before calling GenerateDocumentation() doesn't seem to work...
The bug with formatting indents when generating code is fixed. Look forward to the next build of Entity Developer.

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Tue 10 Jan 2012 14:33

The documentation generation for Enum members is implemented. We will post here when the corresponding build of Entity Developer is available for download.

Shalex
Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 12 Jan 2012 16:39

New build of Entity Developer 4.2.110 is available for download now!
It can be downloaded from http://www.devart.com/entitydeveloper/download.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=23135 .

Post Reply