ODataConnectedService
ODataConnectedService copied to clipboard
Generated code for Enums should have GeneratedCodeAttribute set
The Connected Service code generator does not place a [GeneratedCode]
attribute on each enum.
Generate code from a model that has an enum.
<EnumType Name="MemberRole">
<Member Name="Participant" Value="0"/>
<Member Name="Leader" Value="1"/>
<Member Name="Assistant" Value="2"/>
</EnumType>
Run code generation and get:
[global::Microsoft.OData.Client.OriginalNameAttribute("MemberRole")]
public enum MemberRole
{
[global::Microsoft.OData.Client.OriginalNameAttribute("Participant")]
Participant = 0,
[global::Microsoft.OData.Client.OriginalNameAttribute("Leader")]
Leader = 1,
[global::Microsoft.OData.Client.OriginalNameAttribute("Assistant")]
Assistant = 2
}
Should be:
[global::Microsoft.OData.Client.OriginalNameAttribute("MemberRole")]
public enum MemberRole
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "#VersionNumber#")]
[global::Microsoft.OData.Client.OriginalNameAttribute("Participant")]
Participant = 0,
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "#VersionNumber#")]
[global::Microsoft.OData.Client.OriginalNameAttribute("Leader")]
Leader = 1,
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "#VersionNumber#")]
[global::Microsoft.OData.Client.OriginalNameAttribute("Assistant")]
Assistant = 2
}
Thank you @dxrdxr for reporting this issue. We welcome a contribution to resolve it if you're in a position to
I'm pretty sure that #VersionNumber#
needs to be replaced with the actual ODataConnectedService version.
Also, shouldn't GeneratedCodeAttribute
be on the enum itself as well, not just its members?