Can I set a global factory object for Protobuf-net?

I see the SetFactory method on Protobuf-net. However, it appears to be available for each type. (And MethodInfo or a string? Can I hear it for Func<T>?)

What I want is the ability to use the resolution and design capabilities of the IoC container for all deserialization. (I use Autofac.) Protobuf-net should first try to use my IoC on any design. If this returns null, then I want the default behavior. Is there any way to do this now? Thank you for your time.

+5
source share
1 answer

Not at present. The reason the delegate does not accept the delegate is because it aims to statically compile the model — MethodInfo is suitable for this, but delegates: not much. However, the factory method you supply can take a serialization context, which can contain any objects you need.

I might think of a factory default method — that sounds possible; I need one of the arguments to be a type, but that is not a problem.

Will it be possible to set the factory factory MethodInfo default value, which can (if required) use the type and serialization context?

+2
source

All Articles