Exemple #1
0
        /// <summary>
        /// Returns an <see cref="T:System.Data.Entity.Core.Metadata.Edm.EntitySet" /> object by using the specified name for the entity set.
        /// </summary>
        /// <returns>
        /// An <see cref="T:System.Data.Entity.Core.Metadata.Edm.EntitySet" /> object that represents the entity set that has the specified name.
        /// </returns>
        /// <param name="name">The name of the entity set that is searched for.</param>
        /// <param name="ignoreCase">true to perform the case-insensitive search; otherwise, false.</param>
        public EntitySet GetEntitySetByName(string name, bool ignoreCase)
        {
            var entitySet = (BaseEntitySets.GetValue(name, ignoreCase) as EntitySet);

            if (null != entitySet)
            {
                return(entitySet);
            }
            throw new ArgumentException(Strings.InvalidEntitySetName(name));
        }
        /// <summary>
        /// Get the entity set with the given name
        /// </summary>
        /// <param name="name">name of the entity set to look up for</param>
        /// <param name="ignoreCase">true if you want to do a case-insensitive lookup</param>
        /// <returns></returns>
        public EntitySet GetEntitySetByName(string name, bool ignoreCase)
        {
            EntitySet entitySet = (BaseEntitySets.GetValue(name, ignoreCase) as EntitySet);

            if (null != entitySet)
            {
                return(entitySet);
            }
            throw EntityUtil.InvalidEntitySetName(name);
        }
Exemple #3
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);
        }
Exemple #4
0
        /// <summary>
        /// Returns an <see cref="T:System.Data.Entity.Core.Metadata.Edm.EntitySet" /> object by using the specified name for the entity set.
        /// </summary>
        /// <returns>true if there is an entity set that matches the search criteria; otherwise, false.</returns>
        /// <param name="name">The name of the entity set that is searched for.</param>
        /// <param name="ignoreCase">true to perform the case-insensitive search; otherwise, false.</param>
        /// <param name="entitySet">
        /// When this method returns, contains an <see cref="T:System.Data.Entity.Core.Metadata.Edm.EntitySet" /> object. If there is no entity set, this output parameter contains null.
        /// </param>
        public bool TryGetEntitySetByName(string name, bool ignoreCase, out EntitySet entitySet)
        {
            Check.NotNull(name, "name");
            EntitySetBase baseEntitySet = null;

            entitySet = null;
            if (BaseEntitySets.TryGetValue(name, ignoreCase, out baseEntitySet))
            {
                if (Helper.IsEntitySet(baseEntitySet))
                {
                    entitySet = (EntitySet)baseEntitySet;
                    return(true);
                }
            }
            return(false);
        }