IDataStore.GetForUpdateList<TModel>(Predicate<TModel> predicate) Method
.NET Standard 2.x
Obtains an IEnumerable<TModel>
object for update according to the specified condition.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
public IEnumerable<TModel> GetForUpdateList<TModel>(Predicate<TModel> predicate);
Parameters
predicate
System.Predicate<TModel>
A Predicate<TModel>
that you want to use as the search criteria.
Returns
System.Collections.Generic.IEnumerable<TModel>
Returns the IEnumerable<TModel>
object which contains the data of the rows.
Remarks
It returns Empty Instance
if no row is found.
Examples
The following code example demonstrates how to find the department record by Predicate<TModel>
object.
using Appeon.ApiDoc.Models;
using DWNet.Data;
using System;
using System.Collections.Generic;
namespace Appeon.ApiDoc.IDataStoreExamples
{
public class GetForUpdateListExample
{
private readonly SchoolContext _context;
public GetForUpdateListExample(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();
// There are 2 records in the Department table whose departmentid
// is less than 3.
var departments = datastore.GetForUpdateList<D_Department>(x => x.Departmentid < 3);
foreach (var item in departments)
{
Console.WriteLine("Department ID: {0},Department Name: {1}",
item.Departmentid, item.Name);
}
/*This code produces the following output:
Department ID: 1,Department Name: Engineering
Department ID: 2,Department Name: English
*/
}
}
}
Example Refer To
Model Class: D_Department
DataWindow File: d_department
Applies to
.NET Standard
2.x