IDataStore.GetModel<TModel>(int row) Method
.NET Standard 2.x | Current Version (1.0.1) 
Obtains the TModel object of the specified row.
Namespace: PowerBuilder.Data
Assembly: PowerBuilder.Data.dll
Syntax
public TModel GetModel<TModel>(int row);
Type Parameters
TModel
The type of a model class that matches with the current DataObject.
Parameters
row System.Int32
The zero-based row number to get data.
Returns
TModel
Return the TModel object which contains the data of the row.
Examples
The following code example demonstrates how to get data according to the row number.
using PowerBuilder.Data;
using System;
namespace Appeon.ApiDoc.IDataStoreExamples
{
public class GetModelExample
{
private SchoolContext _context;
public GetModelExample(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();
var department = datastore.GetModel<D_Department>(0);
Console.WriteLine(
"Department ID: {0};\n" +
"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