Example #1
0
 public static int GetRequiredFieldIndex(
     [NotNull] IRow row,
     [NotNull] Attribute attribute,
     [CanBeNull] IFieldIndexCache fieldIndexCache = null)
 {
     return(GetRequiredFieldIndex(row.Table, attribute, fieldIndexCache));
 }
Example #2
0
        public static T?GetValueFor <T>([NotNull] IRow row,
                                        [NotNull] Attribute attribute,
                                        [CanBeNull] IFieldIndexCache fieldIndexCache)
            where T : struct
        {
            var fieldIndex = GetRequiredFieldIndex(row, attribute, fieldIndexCache);

            return(GdbObjectUtils.ConvertRowValue <T>(row, fieldIndex));
        }
Example #3
0
        public static int GetFieldIndex([NotNull] ITable table,
                                        [NotNull] Attribute attribute,
                                        [CanBeNull] IFieldIndexCache fieldIndexCache = null)
        {
            AttributeRole attributeRole = (attribute as ObjectAttribute)?.Role;

            return
                (fieldIndexCache?.GetFieldIndex(table, attribute.Name, attributeRole) ??
                 GetFieldIndex(table, attribute.Name, attributeRole));
        }
Example #4
0
        public static int GetRequiredFieldIndex(
            [NotNull] ITable table,
            [NotNull] Attribute attribute,
            [CanBeNull] IFieldIndexCache fieldIndexCache = null)
        {
            int fieldIndex = GetFieldIndex(table, attribute, fieldIndexCache);

            if (fieldIndex < 0)
            {
                _msg.DebugFormat("Missing attribute: {0}", attribute);

                throw new InvalidOperationException(
                          string.Format("Field {0} not found in table {1}",
                                        attribute.Name, DatasetUtils.GetName(table)));
            }

            return(fieldIndex);
        }
Example #5
0
 public static object GetValueFor([NotNull] IRow row,
                                  [NotNull] Attribute attribute,
                                  [CanBeNull] IFieldIndexCache fieldIndexCache)
 {
     return(row.Value[GetRequiredFieldIndex(row, attribute, fieldIndexCache)]);
 }