[Mono-bugs] [Bug 650390] Removing a constraint from a DataTable does not nullify it from DataRelation

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Oct 31 11:30:09 EDT 2010


https://bugzilla.novell.com/show_bug.cgi?id=650390

https://bugzilla.novell.com/show_bug.cgi?id=650390#c1


--- Comment #1 from Clinton Volzke <cvolzke at live.com.au> 2010-10-31 15:30:09 UTC ---
Proposed fix:

- Create method:
    private void RemoveConstraintFromRelation(Constraint constraint)
    {
        if (constraint is UniqueConstraint)
        {
            foreach (DataRelation relation in Table.ChildRelations)
            {
                if (relation.ParentKeyConstraint == constraint)
                {
                    relation.SetParentKeyConstraint(null);
                }
            }
        }
        else if (constraint is ForeignKeyConstraint)
        {
            foreach (DataRelation relation in Table.ParentRelations)
            {
                if (relation.ChildKeyConstraint == constraint)
                {
                    relation.SetChildKeyConstraint(null);
                }
            }
        }
    }

- Call RemoveConstraintFromRelation from Remove/Clear in ConstraintCollection.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list