public virtual void DeleteSelf() { foreach (var dirRelationship in DirectedRelationships.ToList()) { dirRelationship.ToTable.RemoveRelationship(dirRelationship.Relationship); dirRelationship.ToTable.RemoveKey(dirRelationship.Relationship.ForeignKey); } _relationships.Clear(); if (Database != null) { if (this.IsView) { Database.DeleteTable(this); } else { Database.DeleteTable(this); } } }