System.Data.DataKey.CheckState C# (CSharp) Метод

CheckState() приватный Метод

private CheckState ( ) : void
Результат void
        internal void CheckState()
        {
            DataTable table = _columns[0].Table;

            if (table == null)
            {
                throw ExceptionBuilder.ColumnNotInAnyTable();
            }

            for (int i = 1; i < _columns.Length; i++)
            {
                if (_columns[i].Table == null)
                {
                    throw ExceptionBuilder.ColumnNotInAnyTable();
                }
                if (_columns[i].Table != table)
                {
                    throw ExceptionBuilder.KeyTableMismatch();
                }
            }
        }

Usage Example

Пример #1
0
        // If we're not in a DataSet relations collection, we need to verify on every property get that we're
        // still a good relation object.
        internal override void CheckState()
        {
            if (_DataSet == null)
            {
                // Make sure columns arrays are valid
                parentKey.CheckState();
                childKey.CheckState();

                if (parentKey.Table.DataSet != childKey.Table.DataSet)
                {
                    throw ExceptionBuilder.TablesInDifferentSets();
                }

                for (int i = 0; i < parentKey.Columns.Length; i++)
                {
                    if (parentKey.Columns[i].DataType != childKey.Columns[i].DataType)
                    {
                        throw ExceptionBuilder.ColumnsTypeMismatch();
                    }
                }

                if (childKey.ColumnsEqual(parentKey))
                {
                    throw ExceptionBuilder.KeyColumnsIdentical();
                }
            }
        }
All Usage Examples Of System.Data.DataKey::CheckState