I have a C # .NET web API project that works with Azure table storage. Some of the methods return lists of various table elements. Until I switched to Microsoft.WindowsAzure.Storage 4.0.0, everything worked perfectly. 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 there is an entry in the change log for Microsoft.WindowsAzure.Storage 4.0.0, which seems to have something, do the following:
- Tables: TableEntity is serialized through the ISerializable interface.
In response to this, I tried to decorate the table entity class with [Serializable] and my custom properties with [DataMember]. 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; }
}
However, only the base properties and my custom properties (Name, ShortName and LicenseGuid) are returned and are not included in the JSON response from the Web API method.
Any ideas? (Now I will return to Microsoft.WindowsAzure.Storage 3.2.1)
source
share