/// <summary>
        /// 
        /// </summary>
        /// <example>
        /// Xml example:
        /// <![CDATA[
        ///		<Property Type="String" Name="City" MaxLength="50" FixedLength="false" Unicode="true" />
        /// ]]>
        /// </example>
        /// <param name="file"></param>
        /// <param name="ct"></param>
        /// <param name="prop"></param>
        /// <returns></returns>
        public static MetaComplexTypeProperty Parse(MetaModel metaModel, MetaComplexType ct, XElement prop)
        {
            var p = new MetaComplexTypeProperty
                        {
                            FullName = ct.FullName.Dot(prop.Att("Name")),
                            Name = prop.Att("Name"),
                            Type = prop.Att("Type"),
                            ComplexType = ct
                        };

            return p;
        }
Example #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <example>
        /// Xml Example:
        /// <![CDATA[
        ///		<ComplexType Name="Location">
        ///			<Property Type="String" Name="City" MaxLength="50" FixedLength="false" Unicode="true" />
        ///			<Property Type="String" Name="State" MaxLength="50" FixedLength="false" Unicode="true" />
        ///			<Property Type="String" Name="Country" MaxLength="50" FixedLength="false" Unicode="true" />
        ///		</ComplexType>
        /// ]]>
        /// </example>
        /// <param name="metaModel"></param>
        /// <param name="cType"></param>
        /// <returns></returns>
        public static MetaComplexType Parse(MetaModel metaModel, XElement cType)
        {
            var fullName = metaModel.Namespace.Dot(cType.Att("Name"));

            if (metaModel.ComplexTypes.ContainsKey(fullName))
                return metaModel.ComplexTypes[fullName];

            var ct = new MetaComplexType();

            ct.FullName = fullName;
            ct.Name = cType.Att("Name");

            foreach (var prop in cType.Es("Property"))
            {
                ct.Properties.Add(MetaComplexTypeProperty.Parse(metaModel, ct, prop));
            }

            metaModel.ComplexTypes.Add(ct.FullName, ct);

            return ct;
        }