Business Logic Framework - Tutorial 3:
Our third tutorial shows you another very powerful feature that creates a Join between two objects. We run the Find method on the Orders class and the parent record values from the Customers table will automatically be included in the result set.
Here is the example code that achieves this:
| using (Orders orders = new Orders()) | |
| { | |
| // this method will join the orders object with the CustomerID_Customers_Parent | |
| // and the parent table's columns will also be included in the result set. | |
| orders.Join_CustomerID_Customers_Parent(); | |
| // we do not want a duplicate CustomerID column in our result set so we set its visibility to false | |
| orders.CustomerID_Customers_Parent.CustomerID.Visible = false; | |
| this.GridView.DataSource = orders.Find(); | |
| this.GridView.DataMember = orders.GetResultSetName(); | |
| } | |
| Using Order As Orders = New Orders() | |
| ' this method will join the orders object with the CustomerID_Customers_Parent | |
| ' and the parent table's columns will also be included in the result set. | |
| Order.Join_CustomerID_Customers_Parent() | |
| ' we do not want a duplicate CustomerID column in our result set so we set its visibility to false | |
| Order.CustomerID_Customers_Parent.CustomerID.Visible = False | |
| Me.GridView.DataSource = Order.Find() | |
| Me.GridView.DataMember = Order.GetResultSetName() | |
| End Using | |
This code above shows that just by writing one line of code you are able to include the parent table's columns in the result set. By default the Join_CustomerID_Customers_Parent creates an Inner Join, but you have the ability to override that as well by passing the JoinTypes.Left or JoinTypes.Right etc. See JoinTypes Enumeration |

This code above shows that just by writing one line of code you are able to include the parent table's columns in the result set. By default the Join_CustomerID_Customers_Parent creates an Inner Join, but you have the ability to override that as well by passing the JoinTypes.Left or JoinTypes.Right etc. See