public void Remove(Constraint constraint)
{
if (constraint == null)
throw ExceptionBuilder.ArgumentNull(nameof(constraint));
// this will throw an exception if it can't be removed, otherwise indicates
// whether we need to remove it from the collection.
if (CanRemove(constraint, true))
{
// constraint can be removed
BaseRemove(constraint);
ArrayRemove(constraint);
if (constraint is UniqueConstraint && ((UniqueConstraint)constraint).IsPrimaryKey)
{
Table.PrimaryKey = null;
}
OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Remove, constraint));
}
}