Skip to content

Instantly share code, notes, and snippets.

@wullemsb
Created October 4, 2025 09:16
Show Gist options
  • Select an option

  • Save wullemsb/1abae07d22aeab822fbde358ea2efa3b to your computer and use it in GitHub Desktop.

Select an option

Save wullemsb/1abae07d22aeab822fbde358ea2efa3b to your computer and use it in GitHub Desktop.
var orders = await context.Orders
.AsNoTrackingWithIdentityResolution()
.Include(o => o.Customer)
.Where(o => o.OrderDate > DateTime.Now.AddDays(-30))
.ToListAsync();
// Now all orders that belong to the same customer
// reference the same Customer instance in memory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment