Show / Hide Table of Contents

    IDataStore<TModel>.GetChild<TChildModel>(Expression<Func<TModel, object>> columnSelector, out IDataStore<TChildModel> child) Method

    .NET Standard 2.x

    Provides a reference to the DataWindowChild, which you can use to manipulate that DataStore.

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

    bool GetChild<TChildModel>(Expression<Func<TModel, object>> columnSelector, out IDataStore<TChildModel> child);
    

    Parameters

    columnSelector Func<TModel, TValue>

    A transform function to apply to each column.

    child IDataStore<TChildModel>

    The reference to the DataWindowChild.

    Returns

    System.Boolean

    Returns true if it succeeds.

    Examples

    The following code example demonstrates how to get the DataWindowChild by Predicate object.

    using Appeon.ApiDoc.Models;
    using DWNet.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataStore_GenericExamples
    {
        public class GetChildExample
        {
            private readonly SchoolContext _context;
    
            public GetChildExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example4()
            {
                // Instantiates a DataStore object with datawindow: d_course.
                var datastore = new DataStore<D_Course>(_context);
    
                datastore.Retrieve();
    
                // The departmentid column has a DropDownDataWindow: dddw_deparment.
                bool result = datastore.GetChild(a => a.Departmentid, out IDataStore<Dddw_Department> department);
    
                Console.WriteLine("Result:{0}", result);
    
                Console.WriteLine("DataWindowChild rowcount: {0}",
                    department.RowCount);
    
                Console.WriteLine(
                    "Department ID: {0}; Department Name: {1}",
                    department.GetItem<int>(1, "departmentid"),
                    department.GetItem<string>(1, "name"));
    
                /*This code produces the following output:
                 
                Result: True
                DataWindowChild rowcount: 4
                Department ID: 2; Department Name: English
                */
            }
        }
    }
    

    Example Refer To

    Model Classes: D_Course Dddw_Department
    DataWindow File: d_course

    Back to top Generated by Appeon