Boolean IsFieldExists(String name, DataType dataType, out FieldMetadata fm) { fm = null; if (_fields.TryGetValue(name, out IDataFieldMetadata ifm)) { fm = ifm as FieldMetadata; if (fm.DataType != dataType) { throw new DataLoaderException($"Invalid property '{name}'. Type mismatch."); } return(true); } return(false); }
public FieldMetadata AddField(FieldInfo field, DataType type, Int32 fieldLen = 0) { if (!field.IsVisible) { return(null); } if (IsFieldExists(field.PropertyName, type, out FieldMetadata fm)) { return(fm); } fm = new FieldMetadata(field, type, fieldLen); _fields.Add(field.PropertyName, fm); switch (field.SpecType) { case SpecType.Id: Id = field.PropertyName; break; case SpecType.Key: Key = field.PropertyName; break; case SpecType.Name: Name = field.PropertyName; break; case SpecType.RowNumber: RowNumber = field.PropertyName; break; case SpecType.RowCount: IsRowCount = true; break; case SpecType.HasChildren: HasChildren = field.PropertyName; break; case SpecType.Permissions: Permissions = field.PropertyName; break; case SpecType.Items: Items = field.PropertyName; break; } return(fm); }