Is it possible to create a protobuf-net serialization assembly for Silverlight and .NET?

不想你离开。 提交于 2019-12-10 10:41:53

问题


I wonder if there is a tool like sgen for protobuf-net...


回答1:


I haven't finished the tooling in that area, but note that RuntimeTypeModel has a Compile() method that takes a path and type name; this is the method you want. I suggest trying this from a "full" .NET console application to generate the ell then reference that from SL (also referencing the SL build of the protobuf-net dll).

You might get an IDE warning about the reference, but from memory it should work. Long term I suspect I need to switch to the IKVM emit (to explicitly target SL), and either way I need to build an exe to do this for you automatically (presumably using some pattern to find a method to generate your RuntimeTypeModel through code).

Once you have that reference you can use the model you named when generating it; new this up and away you go.

Note that when using this approach, you can't serialize against private members - the runtime will not allow it.




回答2:


not sure i got your question right, but we use this which creates CS files for us when we give proto files



来源:https://stackoverflow.com/questions/6491256/is-it-possible-to-create-a-protobuf-net-serialization-assembly-for-silverlight-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!