Azure Table Storage, WCF Service and Enum
Enum is not supported. Even though it is defined like an int, it is really not an integral type supported by Table Storage. Here is the list of types supported. An enum is just a string expression of an integral number with an object-oriented flavor.
You can store int in table storage and then convert it using Enum.Parse.
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.
ya i was having this same problemi changed my property which was earlier enum to int. now this int property parses the incoming int and saves it into a variale of the same enum type so now the code that was
public CompilerOutputTypes Type {get; set;}
is chaged to
private CompilerOutputTypes type;public int Type { get {return (int)type;} set { type = (CompilerOutputTypes)value; }}