我想谈谈使用protobuf网使用http://code.google.com/p/metasyntactic/wiki/ProtocolBuffersprotobuf网 - 反引号,字典和.proto文件
不幸的是我一直在考虑的.proto文件的iphone C#程序(产生从C#源代码)包括其protoc被拒绝的行:
repeated Pair_Guid_List`1 Local = 6;
看来,这是因为源数据是一个C#词典,使用GUID键和类作为值。有办法更好地处理这个问题吗?
使用的protobuf-net版本是r278.zip。
(C#的发送和接收这些protobufs一切工作正常,只是当我们添加了iPhone混进去,这成为一个问题。)
UPDATE:现在所有的工作感谢马克!
在C#侧的对象竟然是:
[ProtoMember(7)]
public Dictionary<Guid, List<Pages>> ReceivedPages { get; set; }
其工作得很好利用在.proto以下:
message PagesDict {
required bcl.Guid guid = 1;
repeated Pages Pages = 2;
}
问题
与消息含有:
repeated PagesDict ReceivedPages = 7;
谢谢你的回答马克! 我在iPhone上使用http://code.google.com/p/metasyntactic/wiki/ProtocolBuffers - 这会从.proto文件生成本机Objective C代码。 他们的确在使用Serializer.GetProto。 感谢您对建模的描述 - 我会尝试定义这样的消息。 –
JosephH
2010-03-29 05:30:24
只是说,我确实得到了这一切工作。 C#端的对象竟然是: [ProtoMember(7)] public Dictionary> ReceivedPages {get;组; } 在.proto中使用以下内容可以很好地工作: message PagesDict { required bcl.Guid guid = 1; 重复Pages Pages = 2; } 重复PagesDict ReceivedPages = 6; –
JosephH
2010-05-19 10:21:42