コード例 #1
0
        public AddmlFieldDefinition(string name,
                                    int?startPosition,
                                    int?fixedLength,
                                    DataType type,
                                    bool isUnique,
                                    bool isNullable,
                                    int?minLength,
                                    int?maxLength,
                                    FieldIndex foreignKeyIndex,
                                    AddmlRecordDefinition addmlRecordDefinition,
                                    List <string> processes,
                                    List <AddmlCode> codes)
        {
            Name                  = name;
            StartPosition         = startPosition;
            FixedLength           = fixedLength;
            Type                  = type;
            IsUnique              = isUnique;
            IsNullable            = isNullable;
            MinLength             = minLength;
            MaxLength             = maxLength;
            ForeignKeyIndex       = foreignKeyIndex;
            AddmlRecordDefinition = addmlRecordDefinition;
            Processes             = processes;
            Codes                 = codes;

            _index = new FieldIndex(AddmlRecordDefinition.AddmlFlatFileDefinition.Name, AddmlRecordDefinition.Name, Name);
        }
コード例 #2
0
        internal AddmlRecordDefinition AddAddmlRecordDefinition(string name, int?recordLength,
                                                                string recordDefinitionFieldValue, List <string> processes)
        {
            AddmlRecordDefinition addmlFieldDefinition = new AddmlRecordDefinition(this,
                                                                                   name,
                                                                                   recordLength,
                                                                                   recordDefinitionFieldValue,
                                                                                   processes);

            AddmlRecordDefinitions.Add(addmlFieldDefinition);
            return(addmlFieldDefinition);
        }
コード例 #3
0
        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);
                }
            }
        }
コード例 #4
0
 public string Key()
 {
     return(AddmlRecordDefinition.Key() + "_" + Name);
 }