Show / Hide Table of Contents

    IDataStore<TModel>.All(Func<TModel, bool> predicate) Method

    .NET Standard 2.x

    Determines whether all rows in the primary buffer of the DataStore satisfy the condition.

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

      bool All(Func<TModel, bool> predicate);
    

    Parameters

    predicate Func<TModel, bool>

    A Func<TModel, bool> that defines the condition.

    Return

    System.Boolean

    Returns true if all rows in the primary buffer satisfy the condition or if there is no data in the primary buffer, otherwise, returns false.

    Examples

    The following code example demonstrates how to use the All method to determine whether all records in the DataStore meet the criteria.

    using Appeon.ApiDoc.Models;
    using DWNet.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataStore_GenericExamples
    {
        public class AllExample
        {
            private readonly SchoolContext _context;
    
            public AllExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example()
            {
                // Instantiates a DataStore object with datawindow object: d_department.
                var datastore = new DataStore<D_Department>(_context);
    
                datastore.Retrieve();
    
                // There is a record in datastore whose Name = "Engineering"
                bool all = datastore.All(a => a.Name == "Engineering");
    
                Console.WriteLine("Engineering: {0}", all);
    
                // All records in the datastore are Startdate="2007-09-01 00:00:00"
                all = datastore.All(a => a.Startdate == DateTime.Parse("2007-09-01 00:00:00"));
    
                Console.WriteLine("Startdate: {0}", all);
    
                /*This code produces the following output:
                
                Engineering: False
                Startdate: True    
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department
    DataWindow File: d_department

    Back to top Generated by Appeon