Tag: SQL
SQL – Structured Query Language – in my usage almost always refers to MSSQL, Microsoft’s SQL Server. Sometimes it’s about configuration, sometimes about actual clauses.
SQL – Structured Query Language – in my usage almost always refers to MSSQL, Microsoft’s SQL Server. Sometimes it’s about configuration, sometimes about actual clauses.
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?
So one day, I needed to quickly check if an identity field in a view in a Microsoft SQL Server was actually unique or not. I was running into weird issues with Entity Framework throwing an error somewhat like this: Store update, insert, or delete statement affected an unexpected number…Continue reading How to form a parameterized SQL query to find duplicates in a table.
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 article explains how to query and remove duplicate entries from a Microsoft SQL database using T-SQL. The same model works both for Azure Databases (in Azure SQL Query Editor) and databases on MS SQL Server (using SSMS – SQL Server Management Studio). I had to do this a while…Continue reading How to clean up duplicates from MS SQL Database?
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
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
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
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.”
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