示例#1
0
        /// <summary>
        ///     Finds all of the relationship classes using the specified <paramref name="source" /> and
        ///     <paramref name="relationshipRole" /> that has been assigned
        ///     any of the <paramref name="modelNames" />.
        /// </summary>
        /// <param name="source">The object class.</param>
        /// <param name="relationshipRole">The relationship role.</param>
        /// <param name="modelNames">The class model names.</param>
        /// <returns>
        ///     Returns a
        ///     <see cref="T:IList{ESRI.ArcGIS.Geodatabase.IRelationshipClass}" />
        ///     representing those relationships that are assigned one or more of the class model names.
        /// </returns>
        /// <exception cref="ArgumentNullException">modelNames</exception>
        public static IEnumerable <IRelationshipClass> GetRelationshipClasses(this ITable source, esriRelRole relationshipRole, params string[] modelNames)
        {
            if (source == null)
            {
                return(null);
            }
            IObjectClass table = source as IObjectClass;

            if (table == null)
            {
                return(null);
            }

            return(table.GetRelationshipClasses(relationshipRole, modelNames));
        }
示例#2
0
        /// <summary>
        ///     Finds the <see cref="IRelationshipClass" /> using the specified <paramref name="source" /> and
        ///     <paramref name="relationshipRole" /> that has been assigned any of the <paramref name="modelNames" />.
        /// </summary>
        /// <param name="source">The object class.</param>
        /// <param name="relationshipRole">The relationship role.</param>
        /// <param name="modelNames">The class model names.</param>
        /// <param name="throwException">
        ///     if set to <c>true</c> if an exception should be thrown when the model name is not
        ///     assigned.
        /// </param>
        /// <returns>
        ///     Returns a <see cref="ESRI.ArcGIS.Geodatabase.IRelationshipClass" /> representing the relationship assigned any of
        ///     the class model names, otherwise <c>null</c>.
        /// </returns>
        /// <exception cref="ArgumentNullException">modelNames</exception>
        /// <exception cref="MissingClassModelNameException"></exception>
        public static IRelationshipClass GetRelationshipClass(this IObjectClass source, esriRelRole relationshipRole, string[] modelNames, bool throwException)
        {
            if (source == null)
            {
                return(null);
            }
            if (modelNames == null)
            {
                throw new ArgumentNullException("modelNames");
            }

            IEnumerable <IRelationshipClass> list = source.GetRelationshipClasses(relationshipRole, modelNames);
            var relClass = list.FirstOrDefault();

            if (relClass == null && throwException)
            {
                throw new MissingClassModelNameException(source, relationshipRole, modelNames);
            }

            return(relClass);
        }
示例#3
0
 /// <summary>
 ///     Finds all of the relationship classes using the specified <paramref name="source" /> and
 ///     <paramref name="relationshipRole" /> that has been assigned
 ///     any of the <paramref name="modelNames" />.
 /// </summary>
 /// <param name="source">The object class.</param>
 /// <param name="relationshipRole">The relationship role.</param>
 /// <param name="modelNames">The class model names.</param>
 /// <returns>
 ///     Returns a
 ///     <see cref="T:IList{ESRI.ArcGIS.Geodatabase.IRelationshipClass}" />
 ///     representing those relationships that are assigned one or more of the class model names.
 /// </returns>
 /// <exception cref="ArgumentNullException">modelNames</exception>
 public static IEnumerable <IRelationshipClass> GetRelationshipClassesAsync(this IObjectClass source, esriRelRole relationshipRole, params string[] modelNames)
 {
     return(Task.Wait(() => source.GetRelationshipClasses(relationshipRole, modelNames)));
 }