public AddmlFieldDefinition(string name, int?startPosition, int?fixedLength, DataType type, bool isUnique, bool isNullable, int?minLength, int?maxLength, AddmlRecordDefinition addmlRecordDefinition, List <string> processes, List <AddmlCode> codes) { Name = name; StartPosition = startPosition; FixedLength = fixedLength; Type = type; IsUnique = isUnique; IsNullable = isNullable; MinLength = minLength; MaxLength = maxLength; AddmlRecordDefinition = addmlRecordDefinition; Processes = processes; Codes = codes; _index = new FieldIndex(AddmlRecordDefinition.AddmlFlatFileDefinition.Name, AddmlRecordDefinition.Name, Name); }
private void AddAddmlFieldDefinitions(AddmlFlatFileDefinition addmlFlatFileDefinition, flatFileDefinition flatFileDefinition) { List <recordDefinition> recordDefinitions = GetRecordDefinitions(flatFileDefinition); foreach (recordDefinition recordDefinition in recordDefinitions) { string recordDefinitionName = recordDefinition.name; int? recordLength = GetRecordLength(recordDefinition); string recordDefinitionFieldValue = recordDefinition.recordDefinitionFieldValue; List <string> recordProcesses = GetRecordProcessNames(addmlFlatFileDefinition.Name, recordDefinition.name); List <AddmlForeignKey> foreignKeys = GetForeignKeysForRecord(flatFileDefinition, recordDefinition); AddmlRecordDefinition addmlRecordDefinition = addmlFlatFileDefinition.AddAddmlRecordDefinition(recordDefinitionName, recordLength, recordDefinitionFieldValue, foreignKeys, recordProcesses); List <fieldDefinition> fieldDefinitions = GetFieldDefinitions(recordDefinition); foreach (fieldDefinition fieldDefinition in fieldDefinitions) { string name = fieldDefinition.name; int? startPosition = GetStartPosition(fieldDefinition); int? endPosition = GetEndPosition(fieldDefinition); // Henter slutt-posisjon med ny funksjon DataType dataType = GetFieldType(fieldDefinition.typeReference); bool isPartOfPrimaryKey = IsPartOfPrimaryKey(recordDefinition, fieldDefinition); bool isUnique = IsUnique(fieldDefinition); bool isNullable = IsNullable(fieldDefinition); int? minLength = GetMinLength(fieldDefinition); int? maxLength = GetMaxLength(fieldDefinition); int? fixedLength = GetFixedLength(fieldDefinition) ?? endPosition - startPosition + 1; List <string> processes = GetFieldProcessNames(flatFileDefinition.name, recordDefinition.name, fieldDefinition.name); List <AddmlCode> addmlCodes = GetCodes(fieldDefinition); AddmlFieldDefinition addAddmlFieldDefinition = addmlRecordDefinition.AddAddmlFieldDefinition( name, startPosition, fixedLength, dataType, isUnique, isNullable, minLength, maxLength, processes, addmlCodes, isPartOfPrimaryKey); FieldIndex fieldIndex = new FieldIndex(flatFileDefinition, recordDefinition, fieldDefinition); if (_allFieldDefinitions.ContainsKey(fieldIndex)) { throw new AddmlDefinitionParseException("ADDML file already contains a field definition with same index: " + fieldIndex); } _allFieldDefinitions.Add(fieldIndex, addAddmlFieldDefinition); } } }
protected bool Equals(FieldIndex other) { return(string.Equals(_flatFileDefinitionName, other._flatFileDefinitionName) && string.Equals(_recordDefinitionName, other._recordDefinitionName) && string.Equals(_fieldDefinitionName, other._fieldDefinitionName)); }
public AddmlForeignKeyValue(FieldIndex index, string value) { Index = index; Value = value; }