Tutorial by Examples

Let's say we have a query of the remaining horsemen that needs to populate a Person class. NameBornResidenceDaniel Dennett1942United States of AmericaSam Harris1967United States of AmericaRichard Dawkins1941United Kingdom public class Person { public string Name { get; set; } public int...
Let's look at a more complex example that contains a one-to-many relationship. Our query will now contain multiple rows containing duplicate data and we will need to handle this. We do this with a lookup in a closure. The query changes slightly as do the example classes. IdNameBornCountryIdCountry...
Sometimes the number of types you are mapping exceeds the 7 provided by the Func<> that does the construction. Instead of using the Query<> with the generic type argument inputs, we will provide the types to map to as an array, followed by the mapping function. Other than the initial ma...
If the query column names do not match your classes you can setup mappings for types. This example demonstrates mapping using System.Data.Linq.Mapping.ColumnAttributeas well as a custom mapping. The mappings only need to be setup once per type so set them on application startup or somewhere else ...

Page 1 of 1