IDataStore<TModel>.Min(Func<TModel, double> selector) Method
.NET Standard 2.x
Invokes a transform function on each row of the primary buffer in the DataStore and returns the minimum result value.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
double Min(Func<TModel, double> selector);
Parameters
selector
Func<TModel, double>
A transform function to apply to each row.
Returns
System.Double
The minimum value.
Examples
The following code example demonstrates how to get the minimum value for budget from the Department table.
using Appeon.ApiDoc.Models;
using DWNet.Data;
using System;
namespace Appeon.ApiDoc.IDataStore_GenericExamples
{
public class MinExample
{
private readonly SchoolContext _context;
public MinExample(SchoolContext dataContext)
{
// Sets the data context
_context = dataContext;
}
public void Example9()
{
// Instantiates a DataStore object with datawindow: d_department.
var datastore = new DataStore<D_Department>(_context);
datastore.Retrieve();
// Gets the minimum value for budget.
// The smallest budget is 120000.00
double MinBudget = datastore.Min(d => (double)d.Budget);
Console.WriteLine("Min Budget: {0}", MinBudget);
/*This code produces the following output:
Min Budget: 120000.0000
*/
}
}
}
Example Refer To
Model Class: D_Department
DataWindow File: d_department