Fix the ‘Unable to resolve service for type Microsoft EntityFrameworkCore DbContext’ error after scaffolding an MVC Controller in Visual Studio

If you’ve got this error after scaffolding a controller which uses Entity Framework Core like below… it means you haven’t … Continue reading Fix the ‘Unable to resolve service for type Microsoft EntityFrameworkCore DbContext’ error after scaffolding an MVC Controller in Visual Studio

Using split queries (AsSplitQuery) in Entity Framework Core to avoid the cartesian explosion problem

Without lazy loading in Entity Framework Core we must eagerly load related entities which means we can experience the ‘cartesian … Continue reading Using split queries (AsSplitQuery) in Entity Framework Core to avoid the cartesian explosion problem

Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details

You may see this exception when doing a DbContext.SaveChanges() call. You then may go drilling into the exception details to … Continue reading Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details

Improving performance of read only selects in entity framework by turning off tracking with AsNoTracking method

We had a new contractor start the other day in work and he brought to my attention the ability to … Continue reading Improving performance of read only selects in entity framework by turning off tracking with AsNoTracking method