IDataStore<TModel>.GetValues<TValue>(Func<TModel, TValue> selector, DwBuffer bufferType = DwBuffer.Primary) Method
.NET Standard 2.x
Obtains a collection of values of the column (specified by expression), from the specified buffer in the DataStore.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
public IEnumerable<TValue> GetValues<TValue>(Func<TModel, TValue> selector, DwBuffer bufferType = DwBuffer.Primary);
Parameters
column
Func<TModel, TValue>
A transform function to apply to each column.
bufferType
DWNet.Data.DwBuffer
The specified buffer of the DataStore. The default is DwBuffer.Primary
.
Returns
System.Collections.Generic.IEnumerable<TValue>
Returns an IEnumerable<TValue>
which can be used to read the data in the collection.
Examples
The following code example demonstrates how to use the GetValues
method to get values (specified by an expression).
using Appeon.ApiDoc.Models;
using DWNet.Data;
using System;
using System.Collections.Generic;
namespace Appeon.ApiDoc.IDataStore_GenericExamples
{
public class GetValuesExample
{
private readonly SchoolContext _context;
public GetValuesExample(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();
// Gets the value of the Departmentid column.
var ids = datastore.GetValues(a => a.Departmentid, DwBuffer.Primary);
foreach (var item in ids)
{
Console.WriteLine("DepartmentId:{0}", item);
}
/*This code produces the following output:
DepartmentId:1
DepartmentId:2
DepartmentId:4
DepartmentId:7
*/
}
}
}
Example Refer To
Model Class: D_Department
DataWindow File: d_department
Applies to
.NET Standard
2.x