Ejemplo n.º 1
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 table.</param>
        /// <param name="modelName">The field modelname.</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 ITable source, string modelName, bool throwException)
        {
            if (source == null)
            {
                return(-1);
            }
            IObjectClass table = source as IObjectClass;

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

            return(table.GetFieldIndex(modelName, throwException));
        }
Ejemplo n.º 2
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>
 /// <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)
 {
     return(source.GetFieldIndex(modelName, true));
 }