IDataStore<TModel>.FindAll(Predicate<TModel> predicate) 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);
Parameters
predicate
Predicate<TModel>
A Predicate<TModel>
object that you want to use as the search criteria.
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 Predicate<TModel>
object.
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 Example1()
{
// 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);
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: null;
PersonID ID: 2; FirstName: Gytis; LastName: Barzdukas; Compute_Fullname: null;
*/
}
}
}
Example Refer To
Model Class: D_Person_With_Dwcompute
DataWindow File: d_person_with_dwcompute