What are the advantages of using an ORM? [closed]

I’d say that if you aren’t dealing with objects there’s little point in using an ORM. If your relational tables/columns map 1:1 with objects/attributes, there’s not much point in using an ORM. If your objects don’t have any 1:1, 1:m or m:n relationships with other objects, there’s not much point in using an ORM. If … Read more

How do I map lists of nested objects with Dapper

Alternatively, you can use one query with a lookup: var lookup = new Dictionary<int, Course>(); conn.Query<Course, Location, Course>(@” SELECT c.*, l.* FROM Course c INNER JOIN Location l ON c.LocationId = l.Id “, (c, l) => { Course course; if (!lookup.TryGetValue(c.Id, out course)) lookup.Add(c.Id, course = c); if (course.Locations == null) course.Locations = new List<Location>(); … Read more