Example #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>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);
        }
Example #2
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 <string>(name, nameof(name));
            EntitySetBase entitySetBase = (EntitySetBase)null;

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