是否有可能创建一个protobuf网序列化组件Silverlight和.NET? [英] Is it possible to create a protobuf-net serialization assembly for Silverlight and .NET?
问题描述
我不知道是否有像SGEN的protobuf网...
I wonder if there is a tool like sgen for protobuf-net...
推荐答案
我还没有完成在该领域的工具,但要注意RuntimeTypeModel有一个编译()方法,它的路径和类型名;这是你想要的方式。我建议从全.NET控制台应用程序尝试这种 生成ELL然后引用,从SL(也引用在的 SL 的打造的protobuf网的dll)。
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).
您可能会得到一个IDE警告有关的参考,但是从内存中它应该工作。长期我怀疑我需要切换到IKVM发射出(明确目标SL),和无论哪种方式的我需要建立一个exe来(presumably使用某种模式来自动为你做这个找到一个方法来生成到code本RuntimeTypeModel)。
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.
这篇关于是否有可能创建一个protobuf网序列化组件Silverlight和.NET?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!