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 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?