IDataStore.RemoveAll<TModel>(Predicate<TModel> predicate) Method
.NET Standard 2.x
Removes rows that meet the specified conditions from the primary buffer of the DataStore.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
public int RemoveAll<TModel>(Predicate<TModel> predicate);
Type Parameters
TModel
Parameters
predicate
System.Predicate<TModel>
A Predicate<TModel>
object that you want to use as the search criteria.
Returns
System.Int32
Number of rows that are successfully removed.
Examples
The following code example demonstrates how to remove the data item according to the specified TModel
.
using Appeon.ApiDoc.Models;
using DWNet.Data;
using System;
namespace Appeon.ApiDoc.IDataStoreExamples
{
public class RemoveAllExample
{
private readonly SchoolContext _context;
public RemoveAllExample(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();
Console.WriteLine("Before Remove, Rowcount: {0}", datastore.RowCount);
// Removes the data item
datastore.RemoveAll<D_Department>(a => a.Departmentid == 1);
Console.WriteLine("After Remove, Rowcount: {0}", datastore.RowCount);
/*This code produces the following output:
Before Remove, Rowcount: 4
After Remove, Rowcount: 3
*/
}
}
}
Example Refer To
Model Class: D_Department
DataWindow File: d_department
Applies to
.NET Standard
2.x