Skip to content

Commit 81617b6

Browse files
committed
That means that you don't need to use explicit eager loading (Include) with ProjectTo.
1 parent 94296ab commit 81617b6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs/Queryable-Extensions.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@ select new InstructorIndexData.InstructorModel
8989
};
9090
```
9191

92-
This map through AutoMapper will result in a SELECT N+1 problem, as each child `Course` will be queried one at a time, unless specified through your ORM to eagerly fetch. With LINQ projection, no special configuration or specification is needed with your ORM. The ORM uses the LINQ projection to build the exact SQL query needed.
92+
This map through AutoMapper will result in a SELECT N+1 problem, as each child `Course` will be queried one at a time, unless specified through your ORM to eagerly fetch. With LINQ projection, no special configuration or specification is needed with your ORM. The ORM uses the LINQ projection to build the exact SQL query needed.
93+
94+
That means that you don't need to use explicit eager loading (`Include`) with `ProjectTo`. If you need something like filtered `Include`, have the filter in your map:
95+
96+
`CreateProjection<Entity, Dto>().ForMember(d => d.Collection, o => o.MapFrom(s => s.Collection.Where(i => ...));`
9397

9498
### Custom projection
9599

0 commit comments

Comments
 (0)