DataStore<TModel>.DataStore(IEnumerable<TModel> items) Constructor
.NET Standard 2.x
Initializes a new instance of the DataStore class using a sequence of TModel
objects.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
public DataStore(IEnumerable<TModel> items);
Parameters
items
System.Collections.Generic.IEnumerable<TModel>
A sequence of TModel
objects which contain data.
Examples
The following code example creates a DataStore object and inserts data to it.
using Appeon.ApiDoc.Models;
using DWNet.Data;
using System;
using System.Collections.Generic;
namespace Appeon.ApiDoc.DataStore_GenericExamples
{
public class DataStore_GenericExample
{
private readonly SchoolContext _context;
public DataStore_GenericExample(SchoolContext dataContext)
{
// Set Data Context
_context = dataContext;
}
public void Example3()
{
var items = new List<D_Department>
{
new D_Department{ Departmentid = 1, Name = "Design" },
new D_Department{ Departmentid = 2, Name = "Product" }
};
// Instantiates the datastore with d_department DataWindow
var department = new DataStore<D_Department>(items);
int row = department.RowCount;
Console.WriteLine("Row Count = {0}", row);
/*This code produces the following output:
Row Count = 2
*/
}
}
}
Example Refer To
Model Class: D_Department
DataWindow File: d_department
Applies to
.NET Standard
2.x