IDataStore.Current Property
.NET Standard 2.x
Gets the currently referenced row in the enumerator.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
public TModel Current { get; }
Property Value
TModel
The currently referenced row in the enumerator.
Remarks
This method can be used together with DataStore.MoveNext
to get all of the data rows by traversing DataStore.
Examples
The following code example demonstrates how to use the Current
property to show the value of the Name column of the specified row.
using Appeon.ApiDoc.Models;
using DWNet.Data;
using System;
namespace Appeon.ApiDoc.IDataStoreExamples
{
public class CurrentExample
{
private readonly SchoolContext _context;
public CurrentExample(SchoolContext dataContext)
{
// Sets the data context
_context = dataContext;
}
public void Example()
{
// Instantiates datastore with datawindow: d_department
var datastore = new DataStore("d_department", _context);
datastore.Retrieve();
Console.WriteLine("Retrieved Rowcount: {0}", datastore.RowCount);
// Moves to the next row
datastore.MoveNext();
// Gets the current row of the DataStore
var currenRow = (D_Department)datastore.Current;
// Shows the Name value of the current row in DataStore
Console.WriteLine("The Name value of the current row: {0}",
currenRow.Name);
/*This code produces the following output:
Retrieved Rowcount: 4
The Name value of the current row: Engineering
*/
}
}
}
Example Refer To
Model Class: D_Department
DataWindow File: d_department
Applies to
.NET Standard
2.x