/// <summary>
        /// Gets a type serializer builder for the given type.
        /// The serializer is created when needed.
        /// </summary>
        public TypeSerializerBuilder GetSerializer(TypeDefinition type)
        {
            TypeSerializerBuilder builder;

            if (typeSerializerBuilders.TryGetValue(type, out builder))
            {
                return(builder);
            }

            builder = new TypeSerializerBuilder(type);
            typeSerializerBuilders.Add(type, builder);
            return(builder);
        }
        private void ProcessSerializers(ProxySerializationContext context)
        {
            if (InterfaceMethod.ReturnType != null)
            {
                var typeDefinition = InterfaceMethod.ReturnType.Resolve();
                if (typeDefinition.FullName != "System.Void")
                {
                    typeDeserializerBuilder = context.GetDeserializer(typeDefinition);
                    deserializerTypeIsArray = InterfaceMethod.ReturnType.IsArray;
                }
            }

            if (!string.IsNullOrEmpty(toSerializeArgument))
            {
                var parameter      = InterfaceMethod.Parameters.First(p => p.Name == toSerializeArgument);
                var typeDefinition = parameter.ParameterType.Resolve();
                typeSerializerBuilder = context.GetSerializer(typeDefinition);
                serializerTypeIsArray = parameter.ParameterType.IsArray;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Gets a type serializer builder for the given type.
        /// The serializer is created when needed.
        /// </summary>
        public TypeSerializerBuilder GetSerializer(TypeDefinition type)
        {
            TypeSerializerBuilder builder;
            if (typeSerializerBuilders.TryGetValue(type, out builder))
                return builder;

            builder = new TypeSerializerBuilder(type);
            typeSerializerBuilders.Add(type, builder);
            return builder;
        }
        private void ProcessSerializers(ProxySerializationContext context)
        {
            if (InterfaceMethod.ReturnType != null)
            {
                var typeDefinition = InterfaceMethod.ReturnType.Resolve();
                if (typeDefinition.FullName != "System.Void")
                {
                    typeDeserializerBuilder = context.GetDeserializer(typeDefinition);
                    deserializerTypeIsArray = InterfaceMethod.ReturnType.IsArray;
                }
            }

            if (!string.IsNullOrEmpty(toSerializeArgument))
            {
                var parameter = InterfaceMethod.Parameters.First(p => p.Name == toSerializeArgument);
                var typeDefinition = parameter.ParameterType.Resolve();
                typeSerializerBuilder = context.GetSerializer(typeDefinition);
                serializerTypeIsArray = parameter.ParameterType.IsArray;
            }
        }