Show / Hide Table of Contents

    IDataStoreBase.ResetUpdate() Method

    .NET Standard 2.x

    Clears the update flags in the primary and filter buffers and empties the delete buffer of the DataStore.

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

      public bool ResetUpdate();
    

    Returns

    System.Boolean

    Returns true if it succeeds.

    Remarks

    When a row is changed, inserted, or deleted, its update flag is set, making it marked for update. By default the Update method turns these flags off. If you want to coordinate updates of more than one DataStores, however, you can prevent Update from clearing the flags. Then, after you verify that all the updates succeeded, you can call ResetUpdate for each DataStore to clear the flags.

    You can find out which rows are marked for update with the GetIRowStatus method. If a row is in the delete buffer or if it is in the primary or filter buffer and has ModelState.NewModified or ModelState.Modified status, its update flag is set. After update flags are cleared, all rows have the status ModelState.NotModified or ModelState.New and the delete buffer is empty.

    Examples

    The following code example demonstrates how to reset the update flags of DataStore.

    using DWNet.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataStoreBaseExamples
    {
        public class ResetUpdateExample
        {
            private readonly SchoolContext _context;
    
            public ResetUpdateExample(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();
    
                // Changes the name value for the first row to "New Department"
                datastore.SetItem(0, "name", "New Department");
    
                Console.WriteLine("Before ResetUpdate, Modifiedcount: {0}",
                    datastore.ModifiedCount);
    
                // Calls resetupdate to clear the update flags of datastore
                datastore.ResetUpdate();
    
                Console.WriteLine("After ResetUpdate, Modifiedcount: {0}",
                    datastore.ModifiedCount);
    
                /*This code produces the following output:
                
                Before ResetUpdate, Modifiedcount: 1
                After ResetUpdate, Modifiedcount: 0           
                */
    
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department
    DataWindow File: d_department

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon