Example #1
0
        /// <summary>
        /// Returns a <see cref="T:System.Data.Entity.Core.Metadata.Edm.RelationshipSet" /> object by using the specified name for the relationship set.
        /// </summary>
        /// <returns>true if there is a relationship set that matches the search criteria; otherwise, false. </returns>
        /// <param name="name">The name of the relationship set that is searched for.</param>
        /// <param name="ignoreCase">true to perform the case-insensitive search; otherwise, false.</param>
        /// <param name="relationshipSet">
        /// When this method returns, contains a <see cref="T:System.Data.Entity.Core.Metadata.Edm.RelationshipSet" /> object.
        /// </param>
        public bool TryGetRelationshipSetByName(string name, bool ignoreCase, out RelationshipSet relationshipSet)
        {
            Check.NotNull(name, "name");
            EntitySetBase baseEntitySet = null;

            relationshipSet = null;
            if (BaseEntitySets.TryGetValue(name, ignoreCase, out baseEntitySet))
            {
                if (Helper.IsRelationshipSet(baseEntitySet))
                {
                    relationshipSet = (RelationshipSet)baseEntitySet;
                    return(true);
                }
            }
            return(false);
        }
Example #2
0
        /// <summary>
        /// Returns a <see cref="T:System.Data.Entity.Core.Metadata.Edm.RelationshipSet" /> object by using the specified name for the relationship set.
        /// </summary>
        /// <returns>true if there is a relationship set that matches the search criteria; otherwise, false. </returns>
        /// <param name="name">The name of the relationship set that is searched for.</param>
        /// <param name="ignoreCase">true to perform the case-insensitive search; otherwise, false.</param>
        /// <param name="relationshipSet">
        /// When this method returns, contains a <see cref="T:System.Data.Entity.Core.Metadata.Edm.RelationshipSet" /> object.
        /// </param>
        public bool TryGetRelationshipSetByName(
            string name,
            bool ignoreCase,
            out RelationshipSet relationshipSet)
        {
            Check.NotNull <string>(name, nameof(name));
            EntitySetBase entitySetBase = (EntitySetBase)null;

            relationshipSet = (RelationshipSet)null;
            if (!this.BaseEntitySets.TryGetValue(name, ignoreCase, out entitySetBase) || !Helper.IsRelationshipSet(entitySetBase))
            {
                return(false);
            }
            relationshipSet = (RelationshipSet)entitySetBase;
            return(true);
        }