Show / Hide Table of Contents

    IDataStoreBase.Reset() Method

    .NET Standard 2.x

    Clears all the data from the DataStore.

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

      public bool Reset();
    

    Returns

    True -- to clear all the data from the DataStore.

    False -- not to clear all the data from the DataStore.

    Remarks

    The Reset method is not the same as deleting rows from the DataStore. Reset affects the application only, not the database. If you delete rows and then call the Update method, the rows are deleted from the database table associated with that DataStore. If you call the Reset method and then call the Update method, no changes are made to the database table.

    Examples

    The following code example demonstrates how to clear the data records from DataStore.

    using DWNet.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataStoreBaseExamples
    {
        public class ResetExample
        {
            private readonly SchoolContext _context;
    
            public ResetExample(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();
    
                Console.WriteLine("Before Reset, Rowcount: {0}", datastore.RowCount);
    
                // Calls Reset to clear the contents of DataStore;
                datastore.Reset();
    
                Console.WriteLine("After Reset, Rowcount: {0}", datastore.RowCount);
    
                /*This code produces the following output:
                
                Before Reset, Rowcount: 4
                After Reset, Rowcount: 0           
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department
    DataWindow File: d_department

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon