public static ISerializerStorage <T> CreateCompiled <T, TComp, TBuilder, TProvider>() where TComp : ISerExprCompilerOf <T> where TBuilder : ISerMethodBuilderOf <T, TComp>, new() where TProvider : ISerMatchingProviderOf <T, TComp>, new() { var provider = new TProvider(); var builder = new TBuilder(); var strategy = provider.Build(); builder.Strategy = strategy; return(new SerializerStorage <T>(builder.Build())); }
public static ISizeOfStorage <T> CreateCompiled <T, TComp, TBuilder, TProvider>() where TComp : ICalculateFuncCompilerOf <T> where TBuilder : ICalculateFuncBuilderOf <T, TComp>, new() where TProvider : ISizeMatchingProviderOf <T, TComp>, new() { var provider = new TProvider(); var builder = new TBuilder(); var strategy = provider.Build(); builder.Strategy = strategy; return(new SizeOfStorage <T>(builder.Build())); }
object IObjectReference.GetRealObject(StreamingContext context) { ExtensionRegistry registry = context.Context as ExtensionRegistry; TBuilder builder = TemplateInstance.DefaultInstanceForType.CreateBuilderForType(); builder.MergeFrom(_message, registry ?? ExtensionRegistry.Empty); IDeserializationCallback callback = builder as IDeserializationCallback; if (callback != null) { callback.OnDeserialization(context); } TMessage message = _initialized ? builder.Build() : builder.BuildPartial(); callback = message as IDeserializationCallback; if (callback != null) { callback.OnDeserialization(context); } return(message); }