protected void Initialize(Type interfaceType) { this.Serializer = new StrongTypedNodeEndpointSerializer(); var methodInfos = StrongTypedNodeEndpointClientBuilder.GetMethodInfos(interfaceType); foreach (var methodInfo in methodInfos) { foreach (var type in methodInfo .GetParameters() .Select(p => p.ParameterType) .Concat(new Type[] { methodInfo.ReturnType }) .Where(t => t != typeof(INodeEndpointRequest) && t != typeof(void) && t != typeof(Task) && t != typeof(Stream)) ) { if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Task <>)) { this.Serializer.AddDefaultSerializer(type.GetGenericArguments()[0]); } else { this.Serializer.AddDefaultSerializer(type); } } } }
private void Initialize() { this.Serializer = new StrongTypedNodeEndpointSerializer(); foreach (var methodInfo in GetMethodInfos(this.GetType())) { this.methods.Add(methodInfo.Name, methodInfo); foreach (var type in methodInfo .GetParameters() .Select(p => p.ParameterType) .Concat(new Type[] { methodInfo.ReturnType }) .Where(t => t != typeof(INodeEndpointRequest) && t != typeof(void) && t != typeof(Stream)) ) { this.Serializer.AddDefaultSerializer(type); } } }