表实体不是被升级后正常序列化到Microsoft.WindowsAzure.Storage 4.0.0 [英] Table entities not being serialized properly after upgrade to Microsoft.WindowsAzure.Storage 4.0.0

查看:166
本文介绍了表实体不是被升级后正常序列化到Microsoft.WindowsAzure.Storage 4.0.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有天青与表的存储工作的C#.NET的Web API项目。某些方法返回各表的实体列表。直到我升级到4.0.0 Microsoft.WindowsAzure.Storage一切工作就好了。现在只有基本属性(PartitionKey,RowKey,时间戳和ETag)返回和我自己的自定义属性会被忽略,即没有序列号。

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.

我注意到,在变更日志微软。 WindowsAzure.Storage 4.0.0 还有就是好像它可能有一些做的条目:

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:


  • 表:TableEntity是通过ISerializable接口序列化

在回应这个我试过装饰我的表的实体类[Serializable接口]和[数据成员]我的自定义属性。举个例子:

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; }
}

不过,只有基本属性回来了,我的自定义属性(名称,短名称和LicenseGuid),并没有包含在从Web API方法JSON响应。

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.

任何想法? (我要回Microsoft.WindowsAzure.Storage 3.2.1现在)

Any ideas? (I'm going back to Microsoft.WindowsAzure.Storage 3.2.1 for now)

推荐答案

此问题现已解决在你可以从这里抢我们的最新版本 - 的 http://www.nuget.org/packages/WindowsAzure.Storage

This issue has now been fixed in our latest release that you can grab from here - http://www.nuget.org/packages/WindowsAzure.Storage

这篇关于表实体不是被升级后正常序列化到Microsoft.WindowsAzure.Storage 4.0.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆