Esempio n. 1
0
        /// <summary>determines the serialiser responsible for a specified formal type and the parameterattributes attributes</summary>
        /// <param name="formal">The formal type. If formal is modified through mapper, result is returned in this parameter</param>
        /// <param name="attributes">the parameter/field attributes</param>
        /// <returns></returns>
        private Serializer DetermineSerializer(Type formal, AttributeExtCollection attributes)
        {
            CustomMappingDesc customMappingUsed;
            Serializer        serialiser =
                (Serializer)s_mapper.MapClsTypeWithTransform(ref formal, ref attributes,
                                                             this, out customMappingUsed); // formal can be transformed

            if (serialiser == null)
            {
                // no serializer present for Type: formal
                Trace.WriteLine("no serialiser for Type: " + formal);
                throw new BAD_PARAM(9001, CompletionStatus.Completed_MayBe);
            }
            Debug.WriteLine("determined to serialize formal type " + formal + " with : " + serialiser);
            if (customMappingUsed != null)
            {
                // wrap serializer to apply custom mapping
                serialiser = new CustomMappingDecorator(customMappingUsed, serialiser);
            }
            return(serialiser);
        }