tonynhan / protobuf-net

Automatically exported from code.google.com/p/protobuf-net
Other
0 stars 0 forks source link

ProtoBuf enum types should receive [DataContract] and [EnumMember] attributes #65

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Please include an e-mail address if this might need a dialogue!
==============

What steps will reproduce the problem?
1. Create a .proto file with a top level enum, such as:
  enum AnimalType
  {
      COW = 0;
      DOG = 1;
      MONKEY = 2;
      CAT = 3;
  }
2. Generate C# using -p:datacontract

What is the expected output? What do you see instead?
I would expect the resulting C# code to have [DataContract] and 
[EnumMember] attributes on the generated enum, but it doesn't.

Generated:
  public enum AnimalType
  {
      COW = 0,
      DOG = 1,
      MONKEY = 2,
      CAT = 3
  }

Expected:
  [DataContract]
  public enum AnimalType
  {
      [EnumMember]
      COW = 0,

      [EnumMember]
      DOG = 1,

      [EnumMember]
      MONKEY = 2,

      [EnumMember]
      CAT = 3
  }

Original issue reported on code.google.com by scoo...@gmail.com on 10 Aug 2009 at 11:17

GoogleCodeExporter commented 8 years ago
OK; that is pretty simple to fix...

Original comment by marc.gravell on 11 Aug 2009 at 10:08

GoogleCodeExporter commented 8 years ago
r264 (if you need before it is released, just overwrite csharp.xslt)

Original comment by marc.gravell on 14 Aug 2009 at 12:36