Example #1
0
        /// <summary>
        ///     Finds the <see cref="IField" /> that has been assigned the <paramref name="modelName" /> that is within the
        ///     specified <paramref name="source" />.
        /// </summary>
        /// <param name="source">The object class to check for model names</param>
        /// <param name="modelName">The field model name.</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="IField" /> representing the field that has been assigned the field model name.
        /// </returns>
        /// <exception cref="MissingFieldModelNameException"></exception>
        public static IField GetField(this ITable source, string modelName, bool throwException)
        {
            if (source == null)
            {
                return(null);
            }
            IObjectClass table = source as IObjectClass;

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

            return(table.GetField(modelName, throwException));
        }
Example #2
0
        /// <summary>
        ///     Returns the name of the field that is assigned the <paramref name="modelName" /> on the <paramref name="source" />.
        /// </summary>
        /// <param name="source">The object class.</param>
        /// <param name="modelName">The field model name.</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="string" /> representing the name of the field, otherwise <c>null</c>.
        /// </returns>
        /// <exception cref="ArgumentNullException">modelName</exception>
        /// <exception cref="MissingFieldModelNameException"></exception>
        public static string GetFieldName(this IObjectClass source, string modelName, bool throwException)
        {
            if (source == null)
            {
                return(null);
            }
            if (modelName == null)
            {
                throw new ArgumentNullException("modelName");
            }

            IField field = source.GetField(modelName, throwException);

            return((field != null) ? field.Name : null);
        }
Example #3
0
        /// <summary>
        ///     Finds index of the <see cref="IField" /> that has been assigned the <paramref name="modelName" /> that is within
        ///     the
        ///     specified <paramref name="source" />.
        /// </summary>
        /// <param name="source">The object class</param>
        /// <param name="modelName">The field model name.</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 the  <see cref="int" /> representing the index of the field assigned the model name.
        /// </returns>
        /// <exception cref="MissingFieldModelNameException"></exception>
        public static int GetFieldIndex(this IObjectClass source, string modelName, bool throwException)
        {
            if (source == null)
            {
                return(-1);
            }
            if (modelName == null)
            {
                throw new ArgumentNullException("modelName");
            }

            IField field = source.GetField(modelName, throwException);

            return((field != null) ? source.FindField(field.Name) : -1);
        }
Example #4
0
 /// <summary>
 ///     Finds the <see cref="IField" /> that has been assigned the <paramref name="modelName" /> that is within the
 ///     specified <paramref name="source" />.
 /// </summary>
 /// <param name="source">The object class to check for model names</param>
 /// <param name="modelName">The field model name.</param>
 /// <returns>
 ///     Returns the  <see cref="ESRI.ArcGIS.Geodatabase.IField" /> that has been assigned the model name.
 /// </returns>
 /// <exception cref="ArgumentNullException">modelName</exception>
 /// <exception cref="MissingFieldModelNameException"></exception>
 public static IField GetField(this IObjectClass source, string modelName)
 {
     return(source.GetField(modelName, true));
 }