Show / Hide Table of Contents

    IDataStore<TModel>.FindAll(Predicate<TModel> predicate, bool calcCompute) Method

    .NET Standard 2.x

    Finds all of the rows in the specified buffer of the DataStore in which data meets the condition specified by the expression.

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

    IList<TModel> FindAll(Predicate<TModel> predicate, bool calcCompute);
    

    Parameters

    predicate Predicate<TModel>

    A Predicate<TModel> object that you want to use as the search criteria.

    calcCompute System.Boolean

    Whether to calculate columns with DwCompute attribute.

    Returns

    IList<TModel>

    Returns the IList<TModel> object which contains the data for the rows found; and returns Empty Instance if no row is found.

    Examples

    The following code example demonstrates how to find the department record by a Predicate<TModel> object and using the calcCompute parameters.

    using Appeon.ApiDoc.Models;
    using DWNet.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataStore_GenericExamples
    {
        public class FindAllExample
        {
            private readonly SchoolContext _context;
    
            public FindAllExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example2()
            {
                // Instantiates a DataStore object with datawindow: d_person_with_dwcompute.
                var datastore = new DataStore<D_Person_With_Dwcompute>(_context);
    
                datastore.Retrieve();
    
                // There are 2 records in the Department table whose departmentid 
                // is less than 3.
                var personList = datastore.FindAll(d => d.Personid < 3, true);
    
                foreach (var item in personList)
                {
                    Console.WriteLine(
                        "PersonID ID: {0}; FirstName: {1}; LastName: {2}; Compute_Fullname: {3};",
                        item.Personid, item.Firstname, item.Lastname, item.Compute_Fullname);
                }
    
                /*This code produces the following output:
                 
                PersonID ID: 1; FirstName: Kim; LastName: Abercrombie; Compute_Fullname: Kim Abercrombie;
                PersonID ID: 2; FirstName: Gytis; LastName: Barzdukas; Compute_Fullname: Gytis Barzdukas;
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Person_With_Dwcompute
    DataWindow File: d_person_with_dwcompute

    Back to top Generated by Appeon