示例#1
0
        public QaSchemaFieldDomainCodedValues(
            [Doc(nameof(DocStrings.QaSchemaFieldDomainCodedValues_table))][NotNull]
            ITable table,
            [Doc(nameof(DocStrings.QaSchemaFieldDomainCodedValues_maximumNameLength))]
            int maximumNameLength,
            [Doc(nameof(DocStrings.QaSchemaFieldDomainCodedValues_uniqueNamesConstraint))]
            UniqueStringsConstraint
            uniqueNamesConstraint,
            [Doc(nameof(DocStrings.QaSchemaFieldDomainCodedValues_minimumValueCount))]
            int minimumValueCount,
            [Doc(nameof(DocStrings.QaSchemaFieldDomainCodedValues_minimumNonEqualNameValueCount))]
            int
            minimumNonEqualNameValueCount,
            [Doc(nameof(DocStrings.QaSchemaFieldDomainCodedValues_allowEmptyName))]
            bool allowEmptyName)
            : base(table)
        {
            Assert.ArgumentNotNull(table, nameof(table));

            _table                         = table;
            _maximumNameLength             = maximumNameLength;
            _uniqueNamesConstraint         = uniqueNamesConstraint;
            _minimumValueCount             = minimumValueCount;
            _minimumNonEqualNameValueCount = minimumNonEqualNameValueCount;
            _allowEmptyName                = allowEmptyName;
        }
示例#2
0
        private static SimpleSet <string> CreateUniqueNamesSet(
            UniqueStringsConstraint uniqueStringsConstraint)
        {
            switch (uniqueStringsConstraint)
            {
            case UniqueStringsConstraint.None:
                return(null);

            case UniqueStringsConstraint.UniqueExactCase:
                return(new SimpleSet <string>(StringComparer.InvariantCulture));

            case UniqueStringsConstraint.UniqueAnyCase:
                return(new SimpleSet <string>(StringComparer.InvariantCultureIgnoreCase));

            default:
                throw new ArgumentOutOfRangeException(nameof(uniqueStringsConstraint),
                                                      uniqueStringsConstraint,
                                                      @"Unsupported unique constraint");
            }
        }