/// <summary>
 /// An event handler called when a relationship was removed.
 /// </summary>
 /// <param name="sender">The sender object.</param>
 /// <param name="e">The event arguments.</param>
 private void OnRelationshipRemoved(object sender, DbServerRelationshipEventArgs e)
 {
     // Find the corresponding relationship item.
     ListViewItem item = this.listViewRelationships.Items.FirstOrDefault((ListViewItem it) =>
         {
             return object.ReferenceEquals(it.Tag, e.Relationship);
         });
     // If the item is not null.
     if (null != item)
     {
         // Remove the item.
         this.listViewRelationships.Items.Remove(item);
     }
 }
 /// <summary>
 /// An event handler called when a relationship was added.
 /// </summary>
 /// <param name="sender">The sender object.</param>
 /// <param name="e">The event arguments.</param>
 private void OnRelationshipAdded(object sender, DbServerRelationshipEventArgs e)
 {
     // Add a new relationship item.
     ListViewItem item = new ListViewItem(new string[] {
             e.Relationship.LeftTable.LocalName, e.Relationship.LeftField,
             e.Relationship.RightTable.LocalName, e.Relationship.RightField },
         this.imageListSmall.Images.IndexOfKey("Relationship"));
     item.Tag = e.Relationship;
     this.listViewRelationships.Items.Add(item);
 }