public SimpleFlatFieldDefinition[] GetColumns(int length) { Column[] expliciteColumns = ExpliciteColumns; if (Pattern == null && expliciteColumns == null) { throw new DataHolderException( "Array-field \"{0}\" had no Pattern NOR an explicit set of Columns - Make sure either of them are set and valid.", this); } if (Pattern != null && expliciteColumns != null) { throw new DataHolderException( "Array-field \"{0}\" defined Pattern AND an explicit set of Columns - Make sure to only specify one.", (object)this); } if (Pattern != null) { List <SimpleFlatFieldDefinition> flatFieldDefinitionList = new List <SimpleFlatFieldDefinition>(); for (int offset = Offset; offset < Offset + length; ++offset) { flatFieldDefinitionList.Add(new SimpleFlatFieldDefinition(Table, Patterns.Compile(Pattern, offset))); } return(flatFieldDefinitionList.ToArray()); } length = expliciteColumns.Length; SimpleFlatFieldDefinition[] flatFieldDefinitionArray = new SimpleFlatFieldDefinition[length]; for (int index = 0; index < length; ++index) { flatFieldDefinitionArray[index] = new SimpleFlatFieldDefinition(expliciteColumns[index].Table, expliciteColumns[index].Name); } return(flatFieldDefinitionArray); }
public SimpleFlatFieldDefinition[] GetColumns(int length) { var cols = ExpliciteColumns; if (Pattern == null && cols == null) { throw new DataHolderException("Array-field \"{0}\" had no Pattern NOR an explicit set of Columns - Make sure either of them are set and valid.", this); } if (Pattern != null && cols != null) { throw new DataHolderException("Array-field \"{0}\" defined Pattern AND an explicit set of Columns - Make sure to only specify one.", this); } if (Pattern != null) { var list = new List <SimpleFlatFieldDefinition>(); for (var i = Offset; i < Offset + length; i++) { list.Add(new SimpleFlatFieldDefinition(Table, Patterns.Compile(Pattern, i))); } return(list.ToArray()); } //if (cols.Length > length) //{ // throw new DataHolderException("Array-field \"{0}\" had an invalid amount of Columns ({1}) - Required: {2}", this, ExpliciteColumns.Length, length); //} length = cols.Length; var defs = new SimpleFlatFieldDefinition[length]; for (var i = 0; i < length; i++) { defs[i] = new SimpleFlatFieldDefinition(cols[i].Table, cols[i].Name); } return(defs); }