SelectNode.SubNodes Property

Provides access to JOIN clauses.

Namespace: DevExpress.DataAccess.DataFederation

Assembly: DevExpress.DataAccess.v21.2.dll

Declaration

public JoinElementCollection SubNodes { get; }

Property Value

Type Description
JoinElementCollection

A collection of JOIN clauses.

Example

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();

The following code snippets (auto-collected from DevExpress Examples) contain references to the SubNodes property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also