Okay – so that’s a non-descriptive title if I’ve ever written one – I apologize for that! I just couldn’t figure out a way to shorten the error when “Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore” is referencing “Microsoft.AspNetCore.Http.Abstractions”, and even though you’re not referencing that dependency directly, you get an error where you have both 3.x and 5.x or 6.x major versions of the assembly in use. Which, in layman’s terms, is no good. What…Continue reading How to fix another weird Entity Framework Core dependency issue?
This article explains how to achieve that nice configuration where you can reuse your .NET EF Core (Entity Framework Core) entities in different projects – even being separate from the project holding your DbContexts! You might want to do this if you have a common data model between a number of very different projects – but you will still need to have a way to add new migrations, apply the…Continue reading How to run EF Core commands when your entities are in a different project from your dbcontext?
Another day, another issue. This time, I was absent-mindedly following the guidance for a project on how to generate .sql files for .NET EF Core code-first migrations. Don’t ask why that was required, but it was. My migration was simple. Adding an entity with just a few properties. And Entity Framework created my programmatic migration just fine. But when generating the SQL file, I got nothing but an empty file.…Continue reading “dotnet ef script” or “Script-Migration” producing empty .sql files?
I’m using Entity Framework in most of the projects that I’m working on – and for the most part, it’s a pleasure to work with. But as always, there are plenty of chances to run into issues… So obviously, I stumbled into all of the rare stuff that IS broken! This one I hadn’t really seen before: “No database provider has been configured for this DbContext”. This time I encountered…Continue reading How to fix “No database provider has been configured for this DbContext” in EF Core?
Another quick one – I’m sure this doesn’t apply to all cases, but I’m still logging it in case someone (like myself) stumbles upon the issue and finds help here. I was building a solution with some Azure Functions fetching and populating data in a database, and was planning on building a UI for browsing the data at some point later on – but I actually got stuck on the…Continue reading “An assembly specified in the application dependencies manifest was not found” when running Add-Migration in Entity Framework Core?
This article explains how to fix a weird situation where your .NET application utilizing Entity Framework or Entity Framework Core simply crashes without any way to recover or catch the Exception. You only get errors somewhere along the lines of “conversion overflow”. Ah – what a fun little issue! Problem So when you’re trying to instantiate an entity with a property of type decimal, you’ll get one of the 2…Continue reading “Conversion overflow” when reading numeric data from MS SQL database using Entity Framework
Hah – another interesting one. This article describes how to resolve an error along the lines of “Microsoft.Data.SqlClient: Microsoft.Data.SqlClient is not supported on this platform.“, thrown by the Azure Functions host. Apparently, you can run into this issue either on your local development machine or even in Azure. Problem For me, this error popped up after some house cleaning tasks – dependency updates, merging feature branches… You know the stuff.…Continue reading How to resolve “Microsoft.Data.SqlClient is not supported on this platform.” in an Azure Function App?
This article explains how to perform a very simple and lightweight database connection test for an existing database context. A while ago, I needed to develop a simple API that I can poll from a load balancer to see whether: An Azure service hosting it is up and It has a connection to its SQL database This simple API would be used for monitoring purposes – simple stuff, sure, but…Continue reading How to verify connection to database in Entity Framework Core?
This time, I’m happy to present you perhaps the simplest way of fixing an annoying and persistent issue with a misleading error message! Wait, does that sound familiar? It’s almost like that’s what half of my articles are about… Anyway, I was happily going my way about creating a couple of new fields to an entity and then scaffolding my changes to a new migration using Entity Framework Core’s Add-Migration,…Continue reading How to resolve persistent “Build started… Build failed.” when trying to run Entity Framework Core commands?
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 could pretty much be whatever. But in this article, I’ll go through one possibility – hopefully, it helps! Problem So…Continue reading How to resolve another “An error occurred while updating the entries” exception in Entity Framework Core