コード例 #1
0
ファイル: VaryingFieldsSettings.cs プロジェクト: okozelsk/NET
        //Methods
        /// <inheritdoc/>
        protected override void Check()
        {
            List <string> names = new List <string>(TotalNumOfFields);
            int           index = 0;

            foreach (ExternalFieldSettings externalFieldCfg in ExternalFieldsCfg.FieldCfgCollection)
            {
                names.Add(externalFieldCfg.Name);
                ++index;
            }
            if (TransformedFieldsCfg != null)
            {
                foreach (TransformedFieldSettings transformedFieldCfg in TransformedFieldsCfg.FieldCfgCollection)
                {
                    if (names.IndexOf(transformedFieldCfg.Name) != -1)
                    {
                        throw new ArgumentException($"Field name {transformedFieldCfg.Name} is not unique.", "TransformedFieldsCfg");
                    }
                    foreach (string name in TransformerFactory.GetAssociatedNames(transformedFieldCfg.TransformerCfg))
                    {
                        if (names.IndexOf(name) == -1)
                        {
                            throw new ArgumentException($"Inconsistent input field name {name} as an input for transformed field. Field {name} is used before its definition or does not exist.", "TransformedFieldsCfg");
                        }
                    }
                    names.Add(transformedFieldCfg.Name);
                    ++index;
                }
            }
            if (GeneratedFieldsCfg != null)
            {
                foreach (GeneratedFieldSettings generatedFieldCfg in GeneratedFieldsCfg.FieldCfgCollection)
                {
                    if (names.IndexOf(generatedFieldCfg.Name) != -1)
                    {
                        throw new ArgumentException($"Field name {generatedFieldCfg.Name} is not unique.", "GeneratedFieldsCfg");
                    }
                    names.Add(generatedFieldCfg.Name);
                    ++index;
                }
            }
            return;
        }