dotnet / dotnet/efcore

AutoInclude via data annotations

Open
#28,486 5 comments 19 reactions 0 assignees View on GitHub
area-model-building customer-reported
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

AutoInclude is a [not much documented, but very useful feature](https://dotnetcoretutorials.com/2021/03/07/eager-load-navigation-properties-by-default-in-ef-core/) since ef core 5, that allows you to load related entities automatically with model builder like this:

`builder.Navigation(x => x.ContactEmails).AutoInclude();`

I would like to be able to configure this by data annotaions on the model like this:

```
[AutoInclude]
public ICollection ContactEmails {get; set;}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.