Microsoft AVRO能够序列化ConcurrentDictionary吗?

时间:2015-04-13 23:28:21

标签: c# hadoop serialization avro concurrentdictionary

我正在尝试使用Microsoft.Hadoop.Avro库进行序列化。但它无法序列化ConcurrentDictionary类型。它将ConcurrentDictionary视为常规Dictionary并查找Add方法。当然它不存在。

我错过了一些设置吗?我必须明确地将“allowNullable”设置为true以允许字符串为空......

或者我该如何扩展序列化器?我也没有找到任何关于此的信息。我知道它是开源的,但我不想触摸库代码,只需扩展它。

编辑: 示例类:

    [Serializable]
    [DataContract]
    public class CacheItem
    {
        [DataMember]
        private ConcurrentDictionary<string, CacheItemEntity> _cacheItemDictionary = new ConcurrentDictionary<string, CacheItemEntity>();

        ......
    }

2015年4月16日编辑: 对于有兴趣的人,Microsoft AVRO库不支持ConcurrentDictionary到此日期。并且没有确定的计划在不久的将来支持它。

1 个答案:

答案 0 :(得分:0)

没有机会,因为有线/ ipc上的东西我倾向于简单类型数组,字符串,字节等甚至Datetime和ulong都会给你浪费大量时间的问题。