Show / Hide Table of Contents

    IDataStoreBase.RowCount Property

    .NET Standard 2.x

    Gets the total number of rows in the primary buffer of the DataStore.

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

     public int RowCount { get; }
    

    Property Value

    System.Int32

    The total number of rows in the primary buffer of the DataStore.

    Examples

    The following code example gets the total number of the rows in the DataStore first after retrieved and then after filtered.

    using DWNet.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataStoreBaseExamples
    {
        public class RowCountExample
        {
            private readonly SchoolContext _context;
    
            public RowCountExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example()
            {
                // Instantiates datastore with datawindow: d_department
                var datastore = new DataStore("d_department", _context);
    
                datastore.Retrieve();
    
                // Gets the total number of records
                int rowcnt = datastore.RowCount;
    
                Console.WriteLine("Retrieved Rowcount: {0}",
                    rowcnt);
    
                // Filters data that do not meet criteria 'Budget > 200000'
                datastore.SetFilter("Budget > 200000");
                datastore.Filter();
    
                // After data is filtered, gets the total number of records again
                int rowcntnew = datastore.RowCount;
    
                Console.WriteLine("After filtered, Primary Buffer Rowcount: {0}",
                    rowcntnew);
    
                /*This code produces the following output:
                
                Retrieved Rowcount: 4
                After filtered, Primary Buffer Rowcount: 2
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department
    DataWindow File: d_department

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon