我想談談使用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