IDataStore.GetForUpdate<TModel>(int index) Method
.NET Standard 2.x
Obtains a TModel object for update according to the index number.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
  public TModel GetForUpdate<TModel>(int index);
Parameters
index System.Int32
The zero-based index number of the row.
Returns
System.Int32
Returns the TModel object which contains the data for the row found.
Remarks
This method makes a shallow copy of the data, therefore, any changes made to this TModel will affect the data source. To make a deep copy of the data, refer to GetModel.
The index number starts from 0, which is consistent with C#.
Examples
The following code example demonstrates how to get data according to the row number.
using Appeon.ApiDoc.Models;
using DWNet.Data;
using System;
namespace Appeon.ApiDoc.IDataStoreExamples
{
    public class GetForUpdateExample
    {
        private readonly SchoolContext _context;
        public GetForUpdateExample(SchoolContext dataContext)
        {
            // Sets the data context
            _context = dataContext;
        }
        public void Example1()
        {
            // Instantiates a DataStore object with datawindow: d_department.
            var datastore = new DataStore("d_department", _context);
            datastore.Retrieve();
            var department = datastore.GetForUpdate<D_Department>(0);
            Console.WriteLine("Department ID: {0},Department Name: {1}",
                department.Departmentid, department.Name);
            /*This code produces the following output:
             
            Department ID: 1;
            Department Name: Engineering
            */
        }
    }
}
Example Refer To
Model Class: D_Department 
DataWindow File: d_department 
Applies to
.NET Standard
2.x