I have a C#.NET Web API project that works with Azure Table Storage. Some of the methods returns lists of various table entities. Until I upgraded to Microsoft.WindowsAzure.Storage 4.0.0 everything worked just fine. Now only the base properties (PartitionKey, RowKey,Timestamp, and ETag) are returned and my own custom properties are ignored, i.e., not serialized.
I note that in the change log for Microsoft.WindowsAzure.Storage 4.0.0 there is an entry that seems like it might have something to do with this:
- Tables: TableEntity is serializable via the ISerializable interface.
In response to this I tried decorating my table entity class with [Serializable] and my custom properties with [DataMember]. An example:
[Serializable]
public class UserGroup : TableEntity
{
public UserGroup(String PartitionKey, String RowKey)
: base(PartitionKey, RowKey)
{
this.PartitionKey = PartitionKey;
this.RowKey = RowKey;
}
public UserGroup()
{
}
[DataMember]
public String Name { get; set; }
[DataMember]
public String ShortName { get; set; }
[DataMember]
public String LicenseGuid { get; set; }
}
Still, only the base properties are returned, and my custom properties (Name, ShortName, and LicenseGuid) and not included in the JSON response from the Web API method.
Any ideas? (I'm going back to Microsoft.WindowsAzure.Storage 3.2.1 for now)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…