Oof. What even is this title? Descriptive – sure, maybe – but also kinda long. Ah, okay. This article explains how to map complex data types to a SQL database when using Entity Framework. This time, I’m using Fluent API to do this. In my case, I just needed to…Continue reading How to fix “System.InvalidOperationException: The property ‘ItemBody.AdditionalData’ could not be mapped because it is of type ‘IDictionary’, which is not a supported primitive type or a valid entity type. Either explicitly map this property, or ignore it using the ‘[NotMapped]’ attribute or by using ‘EntityTypeBuilder.Ignore’ in ‘OnModelCreating’.” in .NET 7 and Entity Framework?
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…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…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…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!…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…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 EF (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!…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…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: This simple API would be used for monitoring purposes –…Continue reading How to verify connection to the 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…Continue reading How to resolve persistent “Build started… Build failed.” when trying to run Entity Framework Core commands?