This article offers yet another possible fix to an issue, where trying to call SaveChanges() in Entity Framework Core throws a pretty generic “An error occurred while updating the entries”-exception, and you’re left wondering what in tarnation is wrong this time. And admittedly, that’s a really generic error, so it…Continue reading How to resolve another “An error occurred while updating the entries” exception in Entity Framework Core
Recently, while building an app service to host a .NET Core API, I had to implement the logic for using both Read-Only and Read-Write Database Contexts for Entity Framework Core. In this particular case, it was the same database – just different contexts, because depending on the location of the…Continue reading How to implement multiple Connection Strings for one DbContext in EF Core?
This article describes how to access and extract the connection strings from your Entity Framework (Core) database context objects. This is quite convenient if you need to display or log the connection string used for your current DbContext for some reason – or if you somehow form your DbContext objects…Continue reading How to get the EF Core Connection String?
When you’re in your .NET Core project, it’s always easy: you just register your DbContext in ConfigureServices, and then inject it into whichever Page, View or Controller you might need it in. However, when you have another project or solution you’re working on and you’d still like to use the…Continue reading How to create a DbContext from just a connection string?
This is a tip that should often be the first thing you do in your projects with database backend, no matter which technology you use: Add some basic info about modified and created times, and the user information – so that if something happens, everyone will know who to blame…Continue reading How to add creator/modified info to all of your EF models at once in .NET Core
This article describes how to fix a situation, where you can’t use any of the navigation properties of your Entity Framework Core entities, since they are all null, despite data being in the database for sure. So, another day, another error. This time I can’t blame SharePoint, since I just…Continue reading EF Core returns null for a Navigation property
This post describes how you can access your Entity Framework Core model classes and the database context in your Azure Functions. In my example I’m using EF Core 2.1, but the main principle should be the same for later versions as well. Please note, that I use Azure functions runtime…Continue reading How to access Entity Framework Core’s DbContext in an Azure Function?
Another weird, but simple issue I ran into when building a simple .NET Core application. The article should apply to pretty much any .NET Core version, but the version I was on was 2.2. I was just minding my own business, crafting bits of code into something remotely functional, when…Continue reading EntityFramework Core – Update-Database error “The EntityFramework package is not installed”
This post describes one no-brainer fix to the error “An assembly specified in the application dependencies manifest [projectname].deps.json was not found.” I ran into this while running Update-Database for my ASP.NET Core web project, that’s using EntityFrameworkCore 2.1.1. I hadn’t seen this one before, but the error was quite interesting:…Continue reading Fixing “An assembly specified in the application dependencies manifest [projectname].deps.json was not found”