Show / Hide Table of Contents

    IDataStore<TModel>.GetListForUpdate(Predicate<TModel> predicate) Method

    .NET Standard 2.x

    Obtains the IEnumerable<TModel> object according to the specified condition.

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

    IEnumerable<TModel> GetListForUpdate(Predicate<TModel> predicate);
    

    Parameters

    predicate Predicate<TModel>

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

    Returns

    IEnumerable<TModel>

    Returns the IEnumerable<TModel> object which contains the data of the rows.

    Remarks

    It 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;
    using System.Collections.Generic;
    
    namespace Appeon.ApiDoc.IDataStore_GenericExamples
    {
        public class GetListForUpdateExample
        {
            private readonly SchoolContext _context;
    
            public GetListForUpdateExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example()
            {
                // Instantiates a DataStore object with datawindow: d_department.
                var datastore = new DataStore<D_Department>(_context);
    
                datastore.Retrieve();
    
                // There are 2 records in the Department table whose departmentid 
                // is less than 3.
                var departments = datastore.GetListForUpdate(x => x.Departmentid < 3);
    
                foreach (var item in departments)
                {
                    Console.WriteLine("Department ID: {0},Department Name: {1}",
                        item.Departmentid, item.Name);
                }
                /*This code produces the following output:
                 
                Department ID: 1,Department Name: Engineering
                Department ID: 2,Department Name: English
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department
    DataWindow File: d_department

    Back to top Generated by Appeon