Entity Framework Core logo

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?

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?

No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'

Fixing the “No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlClient'” error

This post describes the fix to THE “No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlClient’” error, which Visual Studio throws at your face when you try to run an application on any Windows-based system (or which you’ve dug out of event logs). Also, your application is…Continue reading Fixing the “No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlClient’” error

Applying Entity Framework’s Code-First Migrations against a Database in Azure by running Update-Database

This post describes how to run Entity Framework’s code-first migrations against a database located in Windows Azure. This is done by running the Update-Database commandlet with suitable switches, see below. The problem and symptoms Okay, so you’re developing your MVC+EF cool web app with a database in Azure, and you’re…Continue reading Applying Entity Framework’s Code-First Migrations against a Database in Azure by running Update-Database

Spatial SQL types

Solving the “Spatial types and functions are not available …” -problem

This page describes multiple ways to fix the  ‘Spatial types and functions are not available for this provider because the assembly ‘Microsoft.SqlServer.Types’ version 10 or higher could not be found.‘ exception which comes up during debugging or publishing your program, app or service using DbGeography. Symptoms While running a console…Continue reading Solving the “Spatial types and functions are not available …” -problem

entity-framework-logo

Fixing the error: “Column XX in table dbo.YY is of a type that is invalid for use as a key column in an index.”

While using Entity Framework and code-first migrations, Entity Framework (EF) creates the indexes for you – but what if you need to create a custom one, explicitly based on a certain field/column? Then you’ll have to tell EF which one to use as a key column. Usually, it’s easy –…Continue reading Fixing the error: “Column XX in table dbo.YY is of a type that is invalid for use as a key column in an index.”

Azure SQL Error

Fixing error “Cannot open server – – requested by the login. Client with IP address – – is not allowed to access the server.” in Azure deployments from Visual Studio

This article explains how to work your way around the exception ‘Cannot open server – requested by login…’ The issue is caused by Azure’s firewall logic, which might sometimes appear a little bit overzealous for simple development workloads, and might stop you from accessing your databases from your development machine.…Continue reading Fixing error “Cannot open server – – requested by the login. Client with IP address – – is not allowed to access the server.” in Azure deployments from Visual Studio