Remember that in DevForce we do not join tables. We use or define relations between entity classes in the Object Mapping tool. Relations and relational properties are discussed at some length in chapter 4 of the DevForce Developer's Guide, under the topics "Relational Properties" "Relations."
Once relations are defined in the Object Mapper, they appear as relational properties of a given entity class. For example, the "OrderSummary" class may have relational properties called "Customer" and "Shipper", among others. The value of a "Customer" property for a given OrderSummary entity is actually a Customer entity. The Customer entity will itself have a number of properties such as CompanyName, ContactName, etc. The Customer property is generated from a relationship between Customer and OrderSummary, where Customer is a parent to OrderSummary, as a given Customer can have many Orders (or OrderSummarys). All of this is the functional equivalent of the table joins you are asking about.
When you configure a grid view using, for example, the DataGridViewBindingManager, you specify a specific entity class to bind to. Let us take the example of binding to the OrderSummary class. From the example above, if the Customer class was added to the Model project, the project that contains all the entity classes, then, because in this case a relation between Customer and OrderSummary was defined in the database, such a relation is defined in the Object Mapping tool. In the list of properties for the OrderSummary class in the DataGridViewBindingManager, you will see one called "Customer" . If you expand the node, you will see properties that are part of the Customer class, such CompanyName and ContactName, among many others. In addition to simple properties of the OrderSummary class such as Id, Freight, ShipCity, etc., that you can drag onto the right pane, you can also drag properties such as Customer.CompanyName and Customer.ContactName. When the grid is generated from the binding manager and the application is run, the grid will in fact display data that originates from two different tables, the OrderSummary table and the Customer table. As best as I can tell, this is what you are asking about.
You can see an example of this in the tutorial "Working with Many-to-Many Relations" in the Fundamentals section of the DevForce tutorials. If you look in the completed tutorial at the design view of "EmployeeForm.cs", you will see a number of components in the component tray at the bottom of the design surface. Among them is one called mOrdersDGVBM, which stands for DataGridViewBindingManager. If you click on "Configure Databindings" from the context menu for this component, you will see the properties that are bound to in the form. Among them are Customer.CompanyName, Customer.ContactName, and Shipper.CompanyName. Two of these properties originate from the Customer table, and one of them originates from the Shipper table. Thus, this grid actually shows data from three different tables.
Hope this helps.
Paul Karsh
IdeaBlade Support
|