Example #1
0
        /// <summary>
        /// This method is used to revolve a type inside a serializer.
        /// </summary>
        /// <param name="pTypeElement">The type element.</param>
        /// <returns>The retrieved type.</returns>
        public override Type ResolveType(XElement pTypeElement)
        {
            if (pTypeElement != null)
            {
                if (pTypeElement.Attribute(XConstants.TYPE_REF_ATTRIBUTE) != null)
                {
                    string lTypeRef = pTypeElement.Attribute(XConstants.TYPE_REF_ATTRIBUTE).Value;

                    // Verifying if the reference can be redirected.
                    if (this.mMultiTypeReferences.ContainsKey(lTypeRef))
                    {
                        lTypeRef = this.mMultiTypeReferences[lTypeRef];
                    }

                    if (this.mTypeReferencesByRef.ContainsKey(lTypeRef))
                    {
                        return this.mTypeReferencesByRef[lTypeRef];
                    }
                }

                return pTypeElement.ToType();
            }

            return null;
        }