SelectNode.SubNodes Property

Provides access to JOIN clauses.

Namespace: DevExpress.DataAccess.DataFederation

Assembly: DevExpress.DataAccess.v20.2.dll

Declaration

public JoinElementCollection SubNodes { get; }
Public ReadOnly Property SubNodes As JoinElementCollection

Property Value

Type Description
JoinElementCollection

A collection of JOIN clauses.

Examples

This code snippet demonstrates how to create a query that combnes two tables from different data sources with the JOIN clause.

NOTE

The complete sample project How to Create a Federated Data Source at Runtime is available in the DevExpress Examples repository.

using DevExpress.DataAccess.DataFederation;
// ...
    FederationDataSource federation = new FederationDataSource();

    Source sourceProducts = new Source("Products", CreateSqlDataSource(), "Products");
    Source sourceOrderDetail = new Source("OrderDetail", CreateExcelDataSource("SalesPerson.xlsx", "Data"));

    var sourceNodeProducts = new SourceNode(sourceProducts, "Products");
    var sourceNodeOrderDetail = new SourceNode(sourceOrderDetail, "OrderDetail");

    var query = new SelectNode(sourceNodeProducts)
    {
        Alias = "ProductsOrderDetail",
        SubNodes = {
                new JoinElement {
                    Node = sourceNodeOrderDetail,
                    Condition = $"[{sourceNodeProducts.Alias}.ProductName] == [{sourceNodeOrderDetail.Alias}.ProductName]"
                }
            },
        Expressions = {
            new SelectColumnExpression(sourceNodeProducts, "ProductName"),
            new SelectColumnExpression(sourceNodeProducts, "QuantityPerUnit"),
            new SelectColumnExpression(sourceNodeOrderDetail, "OrderID"),
            new SelectColumnExpression(sourceNodeOrderDetail, "OrderDate"),
            new SelectColumnExpression(sourceNodeOrderDetail, "Quantity"),
            new SelectColumnExpression(sourceNodeOrderDetail, "UnitPrice")
            }
    };
    federation.Queries.Add(query);
    federation.Fill();
See Also