Exemple #1
0
            public int GetFieldIndex([NotNull] string fieldName, [CanBeNull] AttributeRole role)
            {
                int fieldIndex;

                if (!_fieldIndexes.TryGetValue(fieldName, out fieldIndex))
                {
                    fieldIndex = AttributeUtils.GetFieldIndex(_table, fieldName, role);
                    _fieldIndexes.Add(fieldName, fieldIndex);
                }

                return(fieldIndex);
            }
Exemple #2
0
        private int?GetFieldIndex([NotNull] AttributeRole role,
                                  [CanBeNull] IFieldIndexCache fieldIndexCache,
                                  bool roleIsOptional)
        {
            ObjectAttribute attribute = _dataset.GetAttribute(role);

            if (attribute == null)
            {
                if (roleIsOptional)
                {
                    return(null);
                }

                throw new ArgumentException(
                          string.Format("Dataset [{0}] has no attribute role [{1}]",
                                        _dataset.Name, role), nameof(role));
            }

            return(AttributeUtils.GetFieldIndex(_object.Class, attribute, fieldIndexCache));
        }