DataStoreExtensions.GetRowsData<TModel>(DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false) Method
.NET Standard 2.x
Gets the data of all rows in the specified buffer.
Namespace: PowerScript.Bridge
Assembly: PowerScript.Bridge.dll
Syntax
public static TModel[] GetRowsData<TModel>(this IDataStoreBase dataStore, DwBuffer bufferType = DwBuffer.Primary, bool isOriginalValue = false);
Parameters
bufferType
DwNet.Data.DwBuffer
The specified buffer of the DataStore. The default is DwBuffer.Primary
.
isOriginalValue
System.Boolean
Whether to obtain the data that was originally retrieved.
True
: to obtain the data that was originally retrieved.
False
(default): to obtain the current data.
Returns
TModel[]
Returns the TModel[]
object which contains all of the data rows in the specified buffer.
Examples
The following code example demonstrates how to use the GetRowsData
method to get all of the current data values in the primary buffer.
using System;
using DWNet.Data;
using PowerScript.Bridge;
using Appeon.ApiDoc.Models;
namespace Appeon.ApiDoc.DataStoreExtensionsExamples
{
public class GetRowsDataExample
{
private readonly SchoolContext _context;
public GetRowsDataExample(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();
// Modifies the data of 2nd column in 1st row
datastore.SetItem(0, 1, "department name");
// Gets all data in the primary buffer
var models = datastore.GetRowsData<D_Department>(DwBuffer.Primary, false);
Console.WriteLine($"models Length={models.Length}, models[0].Name={models[0].Name}");
/*This code produces the following output:
models Length=4, models[0].Name=department name
*/
}
}
}
Example Refer To
Model Class: D_Department
DataWindow File: d_department
Applies to
.NET Standard
2.x