Receive * .proto files based on C # classes

I have the following use case: there are several assemblies decorated with ProtoContract classes, and I would like to generate proto files based on assemblies. So the question is, how can this be done?

My first intention was to use Serailizer.GetProto, but this is a universal method that does not work for me, because I only know the type of the class at runtime.

Also why in r480 GetProto is not displayed?

I also know about VS08 / 10, but it doesn't seem to help in my scenario.

Thanks in advance.

+4
source share
2 answers

You can use the Serializer.GetProto method with a little reflection:

 var method = typeof(Serializer).GetMethod("GetProto").MakeGenericMethod(type); Func<string> getProto = Delegate.CreateDelegate(typeof(Func<string>), method); var proto = getProto(); 
+4
source

Also why in r480 GetProto is not displayed?

Because I have a limited time and a lot of requests. Recently, I have had a lot of people asking me about GetProto , so I come across this on my list. I should give priority to working on functions in terms of benefits, efforts versus likely use. GetProto not the "core" for serialization, but this is what I want to continue to support. It just takes effort. Using this function is such that I did not find it justifiable to delay the v2 code base.

The good news is that the v2 kernel is not equivalent, and the old common API is supported solely for compatibility. Therefore, when I re-implement this, it will be fully used without generics.


Update: An experimental section of this case was given in r545. It passes the v1 tests, but: there were not many v1 tests for this function! So: I will add some tests for this soon.

+4
source

All Articles