Interface IModelBuilder
Interface for ModelBuilder, which know materialize data from Ado to objects.
Namespace: Kros.KORM.Materializer
Assembly: Kros.KORM.dll
Syntax
public interface IModelBuilder
Examples
var people = database.ModelBuilder.Materialize<Person>(dataTable);
foreach (var person in people)
{
Console.WriteLine(person.FirstName);
}
Methods
Materialize<T>(DataRow)
Materialize data from dataRow
to instances of model type T
.
Declaration
T Materialize<T>(DataRow dataRow)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataRow | dataRow | Data row of the table. |
Returns
Type | Description |
---|---|
T | Model. |
Type Parameters
Name | Description |
---|---|
T | Type of model. |
Examples
var person = database.ModelBuilder.Materialize<Person>(dataRow);
Materialize<T>(DataTable)
Materialize data from data table to instances of model type .
Declaration
IEnumerable<T> Materialize<T>(DataTable table)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataTable | table | The table. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | IEnumerable of models. |
Type Parameters
Name | Description |
---|---|
T | Type of model. |
Examples
var people = database.ModelBuilder.Materialize<Person>(reader);
Materialize<T>(IDataReader)
Materialize data from reader to instances of model type.
Declaration
IEnumerable<T> Materialize<T>(IDataReader reader)
Parameters
Type | Name | Description |
---|---|---|
System.Data.IDataReader | reader | The reader from which materialize data. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> | IEnumerable of models. |
Type Parameters
Name | Description |
---|---|
T | Type of model. |
Remarks
Doesn' call dispose over reader.
Examples
var people = database.ModelBuilder.Materialize<Person>(dataTable);