/// <summary>
        /// Adds a relationship to the database server based on the specified template.
        /// </summary>
        /// <param name="template">The relationship template.</param>
        public void AddRelationship(DbRelationshipTemplate template)
        {
            // Validate the arguments.
            if (null == template) throw new ArgumentNullException("template");

            // Find the relationship tables.
            ITable leftTable;
            ITable rightTable;

            if (!this.tables.TryGetTable(template.LeftTable.Id, out leftTable)) throw new DbException("Cannot add a relationship because the left table does not exist.");
            if (!this.tables.TryGetTable(template.RightTable.Id, out rightTable)) throw new DbException("Cannot add a relationship because the right table does not exist.");

            // Add the relationship.
            this.relationships.Add(leftTable, rightTable, template.LeftField, template.RightField, template.ReadOnly);
        }
        /// <summary>
        /// Removes a relationship from the database server based on the specified template.
        /// </summary>
        /// <param name="template">The relationship template.</param>
        public void RemoveRelationship(DbRelationshipTemplate template)
        {
            // Validate the arguments.
            if (null == template) throw new ArgumentNullException("template");

            // Remove the relationship.
            this.relationships.Remove(template.LeftTable.Id, template.RightTable.Id, template.LeftField, template.RightField);
        }
 /// <summary>
 /// Creates a new relationship template event arguments instance.
 /// </summary>
 /// <param name="template">The table template.</param>
 public DbRelationshipTemplateEventArgs(DbRelationshipTemplate template)
 {
     this.Template = template;
 }