Skip to content
This repository was archived by the owner on Sep 29, 2024. It is now read-only.

DataTableGenerator

Sascha Manns edited this page Sep 6, 2024 · 1 revision

The DataTableGenerator is a generic class that creates a DataTable from any list model.

Instantiation and call

private void YourMethod()
{
List<SourceModel> yourModel = new();
var logger = new ILogger<DataTableGenerator>();
var dtg = new DataTableGenerator<SourceModel>(logger);
var yourDataTable = dtg.GenerateDataTablleFromModelList(yourModel, false);
}

ID field

The method offers two modes. In the "withId = true" mode, a DataTable with an ID field is created. If false is set, a table without an ID field is generated.

Clone this wiki locally