-
Notifications
You must be signed in to change notification settings - Fork 1
Getting Started
Cleve Littlefield edited this page Feb 1, 2016
·
2 revisions
public class FooModel
{
public int Id { get; set; }
public string Name { get; set; }
}
var mapDefinition = new MapDefinition<FooModel>();
mapDefinition.MapType() // Accept default mappings (meaning DB column names )
// See full documentation for more examples on explicit mapping
Then once you have executed your reader and have your reader:
var map = CreateMap(reader, mapDefinition);
var list = new List<T>();
while (await reader.ReadAsync())
{
var item = LoadItem(reader, map);
list.Add(item);
}
return list;
Or just use our helper method:
return await reader.LoadListAsync(mapDefinition);
First initialize your command setting command text, command type, whatever you want. Then to map parameters:
// model is of type FooModel
command.LoadParameters(model);