Skip to main content

280 posts tagged with "C#"

C# Programming Language

View All Tags

How to Reuse a Select Projection with an Expression in EF Core

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

When several queries return the same response, you want one definition of how to build it. The obvious way, a normal C# method inside Select, loads every column, and throws NullReferenceException as soon as it touches a navigation. The same code written as an Expression lets EF Core read it, and it sends only the columns and joins it needs.