I wonder if there is 开发者_运维百科a tool like sgen for protobuf-net...
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.
not sure i got your question right, but we use this which creates CS files for us when we give proto files
精彩评论