Beispiel #1
0
        protected override bool IsValue(int index)
        {
            if (ColumnsDef.Any(c => c.Index == index && c.Role != ColumnRole.Value))
            {
                return(false);
            }

            if (ColumnsDef.Any(c => c.Index == index && c.Role == ColumnRole.Value))
            {
                return(true);
            }

            switch (KeysDef)
            {
            case KeysChoice.First:
                if (index == 0)
                {
                    return(false);
                }
                break;

            case KeysChoice.AllExpectLast:
                if (index != GetLastColumnIndex())
                {
                    return(false);
                }
                break;

            case KeysChoice.All:
                return(false);
            }

            switch (ValuesDef)
            {
            case ValuesChoice.AllExpectFirst:
                return(index != 0);

            case ValuesChoice.Last:
                return(index == GetLastColumnIndex());

            case ValuesChoice.None:
                return(false);
            }

            return(false);
        }
Beispiel #2
0
        protected override bool IsType(string name, ColumnType type)
        {
            if (ColumnsDef.Any(c => c.Name == name && c.Type != type))
            {
                return(false);
            }

            if (ColumnsDef.Any(c => c.Name == name && c.Type == type))
            {
                return(true);
            }

            if (IsKey(name))
            {
                return(type == ColumnType.Text);
            }

            return(IsValue(name) && ValuesDefaultType == type);
        }
Beispiel #3
0
        public bool IsValue(int index)
        {
            if (ColumnsDef.Any(c => c.Index == index && c.Role != ColumnRole.Value))
            {
                return(false);
            }

            if (ColumnsDef.Any(c => c.Index == index && c.Role == ColumnRole.Value))
            {
                return(true);
            }

            switch (ValuesDef)
            {
            case ValuesChoice.AllExpectFirst:
                return(index != 0);

            case ValuesChoice.Last:
                return(index == GetLastColumnIndex());
            }

            return(false);
        }