示例#1
0
        /// <summary>Creates a read-only AssociationEndMember instance.</summary>
        /// <param name="name">The name of the association end member.</param>
        /// <param name="endRefType">The reference type for the end.</param>
        /// <param name="multiplicity">The multiplicity of the end.</param>
        /// <param name="deleteAction">Flag that indicates the delete behavior of the end.</param>
        /// <param name="metadataProperties">Metadata properties to be associated with the instance.</param>
        /// <returns>The newly created AssociationEndMember instance.</returns>
        /// <exception cref="T:System.ArgumentException">The specified name is null or empty.</exception>
        /// <exception cref="T:System.ArgumentNullException">The specified reference type is null.</exception>
        public static AssociationEndMember Create(
            string name,
            RefType endRefType,
            RelationshipMultiplicity multiplicity,
            OperationAction deleteAction,
            IEnumerable <MetadataProperty> metadataProperties)
        {
            Check.NotEmpty(name, nameof(name));
            Check.NotNull <RefType>(endRefType, nameof(endRefType));
            AssociationEndMember associationEndMember = new AssociationEndMember(name, endRefType, multiplicity);

            associationEndMember.DeleteBehavior = deleteAction;
            if (metadataProperties != null)
            {
                associationEndMember.AddMetadataProperties(metadataProperties.ToList <MetadataProperty>());
            }
            associationEndMember.SetReadOnly();
            return(associationEndMember);
        }
示例#2
0
        /// <summary>
        /// Creates a read-only AssociationEndMember instance.
        /// </summary>
        /// <param name="name">The name of the association end member.</param>
        /// <param name="endRefType">The reference type for the end.</param>
        /// <param name="multiplicity">The multiplicity of the end.</param>
        /// <param name="deleteAction">Flag that indicates the delete behavior of the end.</param>
        /// <param name="metadataProperties">Metadata properties to be associated with the instance.</param>
        /// <returns>The newly created AssociationEndMember instance.</returns>
        /// <exception cref="ArgumentException">The specified name is null or empty.</exception>
        /// <exception cref="ArgumentNullException">The specified reference type is null.</exception>
        public static AssociationEndMember Create(
            string name,
            RefType endRefType,
            RelationshipMultiplicity multiplicity,
            OperationAction deleteAction,
            IEnumerable <MetadataProperty> metadataProperties)
        {
            Check.NotEmpty(name, "name");
            Check.NotNull(endRefType, "endRefType");

            var instance = new AssociationEndMember(name, endRefType, multiplicity);

            instance.DeleteBehavior = deleteAction;

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

            instance.SetReadOnly();

            return(instance);
        }
        /// <summary>
        ///     Creates a read-only AssociationEndMember instance.
        /// </summary>
        /// <param name="name">The name of the association end member.</param>
        /// <param name="endRefType">The reference type for the end.</param>
        /// <param name="multiplicity">The multiplicity of the end.</param>
        /// <param name="deleteAction">Flag that indicates the delete behavior of the end.</param>
        /// <param name="metadataProperties">Metadata properties to be associated with the instance.</param>
        /// <returns>The newly created AssociationEndMember instance.</returns>
        /// <exception cref="ArgumentException">The specified name is null or empty.</exception>
        /// <exception cref="ArgumentNullException">The specified reference type is null.</exception>
        public static AssociationEndMember Create(
            string name,
            RefType endRefType,
            RelationshipMultiplicity multiplicity,
            OperationAction deleteAction,
            IEnumerable<MetadataProperty> metadataProperties)
        {
            Check.NotEmpty(name, "name");
            Check.NotNull(endRefType, "endRefType");

            var instance = new AssociationEndMember(name, endRefType, multiplicity);
            instance.DeleteBehavior = deleteAction;

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

            instance.SetReadOnly();

            return instance;
        }