Azure Table Storage, WCF Service and Enum

后端 未结 6 972
故里飘歌
故里飘歌 2021-02-19 09:00

Here\'s my problem. A class which defines an order has a property called PaymentStatus, which is an enum defined like so:

    public en         


        
6条回答
  •  再見小時候
    2021-02-19 09:38

    Here's a simple workaround:

    public int MyEnumValue { get; set; } //for use by the Azure client libraries only
    [IgnoreProperty] public MyEnum MyEnum
    {
        get { return (MyEnum) MyEnumValue; }
        set { MyEnumValue = (int) value; }
    }
    

    It would have been nicer if a simple backing value could have been employed rather than an additional (public!) property - without the hassle of overriding ReadEntity/WriteEntity of course. I opened a user voice ticket that would facilitate that, so you might want to upvote it.

提交回复
热议问题