Beispiel #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();
                }
            }
        }
Beispiel #2
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 void CheckState()
        {
            if (_dataSet == null)
            {
                _parentKey.CheckState();
                _childKey.CheckState();

                if (_parentKey.Table.DataSet != _childKey.Table.DataSet)
                {
                    throw ExceptionBuilder.RelationDataSetMismatch();
                }

                if (_childKey.ColumnsEqual(_parentKey))
                {
                    throw ExceptionBuilder.KeyColumnsIdentical();
                }

                for (int i = 0; i < _parentKey.ColumnsReference.Length; i++)
                {
                    if ((_parentKey.ColumnsReference[i].DataType != _childKey.ColumnsReference[i].DataType) ||
                        ((_parentKey.ColumnsReference[i].DataType == typeof(DateTime)) &&
                         (_parentKey.ColumnsReference[i].DateTimeMode != _childKey.ColumnsReference[i].DateTimeMode) &&
                         ((_parentKey.ColumnsReference[i].DateTimeMode & _childKey.ColumnsReference[i].DateTimeMode) != DataSetDateTime.Unspecified)))
                    {
                        // allow unspecified and unspecifiedlocal
                        throw ExceptionBuilder.ColumnsTypeMismatch();
                    }
                }
            }
        }
Beispiel #3
0
        private void NonVirtualCheckState()
        {
            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.ColumnsReference.Length; i++)
                {
                    if (_parentKey.ColumnsReference[i].DataType != _childKey.ColumnsReference[i].DataType ||
                        ((_parentKey.ColumnsReference[i].DataType == typeof(DateTime)) && (_parentKey.ColumnsReference[i].DateTimeMode != _childKey.ColumnsReference[i].DateTimeMode) && ((_parentKey.ColumnsReference[i].DateTimeMode & _childKey.ColumnsReference[i].DateTimeMode) != DataSetDateTime.Unspecified)))
                    {
                        throw ExceptionBuilder.ColumnsTypeMismatch();
                    }
                }

                if (_childKey.ColumnsEqual(_parentKey))
                {
                    throw ExceptionBuilder.KeyColumnsIdentical();
                }
            }
        }
Beispiel #4
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 void CheckState()
        {
            if (dataSet == null)
            {
                parentKey.CheckState();
                childKey.CheckState();

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

                if (childKey.ColumnsEqual(parentKey))
                {
                    throw ExceptionBuilder.KeyColumnsIdentical();
                }

                for (int i = 0; i < parentKey.Columns.Length; i++)
                {
                    if (parentKey.Columns[i].DataType != childKey.Columns[i].DataType)
                    {
                        throw ExceptionBuilder.ColumnsTypeMismatch();
                    }
                }
            }
        }
Beispiel #5
0
 private void NonVirtualCheckState()
 {
     if (this._DataSet == null)
     {
         this.parentKey.CheckState();
         this.childKey.CheckState();
         if (this.parentKey.Table.DataSet != this.childKey.Table.DataSet)
         {
             throw ExceptionBuilder.TablesInDifferentSets();
         }
         for (int i = 0; i < this.parentKey.ColumnsReference.Length; i++)
         {
             if ((this.parentKey.ColumnsReference[i].DataType != this.childKey.ColumnsReference[i].DataType) || (((this.parentKey.ColumnsReference[i].DataType == typeof(DateTime)) && (this.parentKey.ColumnsReference[i].DateTimeMode != this.childKey.ColumnsReference[i].DateTimeMode)) && ((this.parentKey.ColumnsReference[i].DateTimeMode & this.childKey.ColumnsReference[i].DateTimeMode) != DataSetDateTime.Unspecified)))
             {
                 throw ExceptionBuilder.ColumnsTypeMismatch();
             }
         }
         if (this.childKey.ColumnsEqual(this.parentKey))
         {
             throw ExceptionBuilder.KeyColumnsIdentical();
         }
     }
 }