Beispiel #1
0
        /// <summary>
        /// Creates a new instance of the <see cref="ComplexType " /> type.
        /// </summary>
        /// <param name="name">The name of the complex type.</param>
        /// <param name="namespaceName">The namespace of the complex type.</param>
        /// <param name="dataSpace">The dataspace to which the complex type belongs to.</param>
        /// <param name="members">Members of the complex type.</param>
        /// <param name="metadataProperties">Metadata properties to be associated with the instance.</param>
        /// <exception cref="System.ArgumentNullException">Thrown if either name, namespace or members argument is null.</exception>
        /// <returns>
        /// A new instance a the <see cref="ComplexType " /> type.
        /// </returns>
        /// <notes>
        /// The newly created <see cref="ComplexType " /> will be read only.
        /// </notes>
        public static ComplexType Create(
            string name,
            string namespaceName,
            DataSpace dataSpace,
            IEnumerable <EdmMember> members,
            IEnumerable <MetadataProperty> metadataProperties)
        {
            Check.NotEmpty(name, "name");
            Check.NotEmpty(namespaceName, "namespaceName");
            Check.NotNull(members, "members");

            var complexType = new ComplexType(name, namespaceName, dataSpace);

            foreach (var member in members)
            {
                complexType.AddMember(member);
            }

            if (metadataProperties != null)
            {
                complexType.AddMetadataProperties(metadataProperties);
            }

            complexType.SetReadOnly();
            return(complexType);
        }
        /// <summary>
        /// Creates a new instance of the <see cref="T:System.Data.Entity.Core.Metadata.Edm.ComplexType" /> type.
        /// </summary>
        /// <param name="name">The name of the complex type.</param>
        /// <param name="namespaceName">The namespace of the complex type.</param>
        /// <param name="dataSpace">The dataspace to which the complex type belongs to.</param>
        /// <param name="members">Members of the complex type.</param>
        /// <param name="metadataProperties">Metadata properties to be associated with the instance.</param>
        /// <exception cref="T:System.ArgumentNullException">Thrown if either name, namespace or members argument is null.</exception>
        /// <returns>
        /// A new instance a the <see cref="T:System.Data.Entity.Core.Metadata.Edm.ComplexType" /> type.
        /// </returns>
        /// <notes>
        /// The newly created <see cref="T:System.Data.Entity.Core.Metadata.Edm.ComplexType" /> will be read only.
        /// </notes>
        public static ComplexType Create(
            string name,
            string namespaceName,
            DataSpace dataSpace,
            IEnumerable <EdmMember> members,
            IEnumerable <MetadataProperty> metadataProperties)
        {
            Check.NotEmpty(name, nameof(name));
            Check.NotEmpty(namespaceName, nameof(namespaceName));
            Check.NotNull <IEnumerable <EdmMember> >(members, nameof(members));
            ComplexType complexType = new ComplexType(name, namespaceName, dataSpace);

            foreach (EdmMember member in members)
            {
                complexType.AddMember(member);
            }
            if (metadataProperties != null)
            {
                complexType.AddMetadataProperties(metadataProperties.ToList <MetadataProperty>());
            }
            complexType.SetReadOnly();
            return(complexType);
        }
        /// <summary>
        ///     Creates a new instance of the <see cref="ComplexType " /> type.
        /// </summary>
        /// <param name="name">The name of the complex type.</param>
        /// <param name="namespaceName">The namespace of the complex type.</param>
        /// <param name="dataSpace">The dataspace to which the complex type belongs to.</param>
        /// <param name="members">Members of the complex type.</param>
        /// <param name="metadataProperties">Metadata properties to be associated with the instance.</param>
        /// <exception cref="System.ArgumentNullException">Thrown if either name, namespace or members argument is null.</exception>
        /// <returns>
        ///     A new instance a the <see cref="ComplexType " /> type.
        /// </returns>
        /// <notes>
        ///     The newly created <see cref="ComplexType " /> will be read only.
        /// </notes>
        public static ComplexType Create(
            string name,
            string namespaceName,
            DataSpace dataSpace,
            IEnumerable<EdmMember> members,
            IEnumerable<MetadataProperty> metadataProperties)
        {
            Check.NotNull(name, "name");
            Check.NotNull(namespaceName, "namespaceName");
            Check.NotNull(members, "members");

            var complexType = new ComplexType(name, namespaceName, dataSpace);

            foreach (var member in members)
            {
                complexType.AddMember(member);
            }

            if (metadataProperties != null)
            {
                complexType.AddMetadataProperties(metadataProperties.ToList());
            }

            complexType.SetReadOnly();
            return complexType;
        }