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 app service the app was deployed in, read and write operations might actually go to different database instances, That’s really easy, right? Well… Yes and no. Essentially, it’s easy to spin up, but comes with…Continue reading How to implement multiple Connection Strings for one DbContext in EF Core?
A while ago, I had a situation where a DbContext was misbehaving after deployed to an Azure App Service, and I needed to check the connection string it’s using directly in the code. However, finding the right method actually took me googling, as there were plenty of examples for Entity Framework for .NET Framework, but next no nothing for Entity Framework Core. Let’s fix that. Long story short, here’s how: Posts Related to “How to get the EF Core Connection String?”:The Scary Anatomy of a…Continue reading How to get the EF Core 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 messed up with ASP.NET Core and Entity Framework Core. :) Symptoms No matter what I’d do, I was getting null values for my navigation properties on my entities. They’d would always be null during runtime…Continue reading EF Core returns null for a Navigation property