Show / Hide Table of Contents

    IDataStoreBase.OnRetrieveStart(object sender, DwRetrieveEventArgs e) Method

    .NET Standard 2.x

    This method is called when the DataStore is about to begin the data retrieval. It triggers the RetrieveStart event by default, and it can be overridden in a child class of the DataStore.

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

      public void OnRetrieveStart(object sender, DwRetrieveEventArgs e);
    

    Parameters

    sender System.Object

    An event sender in which the event occurred.

    It is a reference to the current DataStore by default.

    e DWNet.Data.DwRowChangeEventArgs

    A DwRetrieveEventArgs object which can be used to pass by event arguments.

    Remarks

    In the RetrieveStart event: To prevent previously retrieved data from being cleared, set DwRetrieveEventArgs.IsResetBuffer to false to allow the current retrieval process to append new rows to the old data; to cancel the retrieval, set DwRetrieveEventArgs.IsCancel to true.

    Examples

    The following code example gets the total number of data rows before and after data is retrieved.

    using DWNet.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataStoreBaseExamples
    {
        public class OnRetrieveStartExample
        {
            private readonly SchoolContext _context;
    
            public OnRetrieveStartExample(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);
    
                // Defines what to do when Retrieve is about to begin
                datastore.RetrieveStart +=
                    (sender, args) =>
                    {
                        // Executes the following code before Retrieve is executed 
                        Console.WriteLine("Before Retrieve, Rowcount: {0}",
                            args.RowCount);
                    };
    
                // Retrieves rows from the database for datastore.
                // OnRetrieveStart method is called internally to invoke the 
                // RetrieveEnd event.
                datastore.Retrieve();
    
                Console.WriteLine("After Retrieve, Rowcount: {0}",
                    datastore.RowCount);
    
                /*This code produces the following output:
                
                Before Retrieve, Rowcount: 0
                After Retrieve, Rowcount: 4           
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department
    DataWindow File: d_department

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon