Category Archives: General .NET

Issues related to general .NET and C# development

C# Using Dapper as your SQL framework in .NET Core

Dapper is a easy to use object mapper for .NET and .NET Core, an it can be used a variety of ways. I use Dapper instead of Entity Framework because it makes my code less complex. BASICS OF DAPPER: THE … Continue reading

Posted in .net, .NET Core, c#, General .NET | Tagged , , | Leave a comment

C# Remove specific Querystring parameters from URL

These 2 extension methods will remove specific query string parameters from an URL in a safe manner. METHOD #1: SPECIFY THE PARAMETERS THAT SHOULD GO (NEGATIVE LIST): Usage/Test cases: METHOD #2: SPECIFY THE PARAMETERS THAT MAY STAY (POSITIVE LIST): Usage/Test … Continue reading

Posted in .net, .NET Core, c#, General .NET | Tagged , | 2 Comments

Sitecore ComputedIndexField extends your SOLR index

The Sitecore SOLR index is your quick access to Sitecore content. And you can extend this access by adding computed index fields. This is a way of enriching your searches with content that is not part of your Sitecore templates, … Continue reading

Posted in General .NET, Sitecore, Sitecore 5, Sitecore 6, Sitecore 7, Sitecore 8, Sitecore 9 | Tagged , , | Leave a comment

Handling “415 Unsupported Media Type” in .NET Core API

The default content type for .NET Core API’s is application/json. So if the content-type is left out, or another content type is used, you will get a “415 Unsupported Media Type”: This is for example true if you develop an … Continue reading

Posted in .NET Core, c#, General .NET | Tagged , , | Leave a comment

C# Newtonsoft camelCasing the serialized JSON output

JSON love to be camelCased, while the C# Model class hates it. This comes down to coding style, which is – among developers – taken more seriously than politics and religion. But fear not, with Newtonsoft (or is it newtonSoft … Continue reading

Posted in .net, .NET Core, c#, General .NET | Tagged , , , , , | Leave a comment

C# get results from Task.WhenAll

The C# method Task.WhenAll can run a bunch of async methods in parallel and returns when every one finished. But how do you collect the return values? Imagine that you have this pseudo-async-method: And you wish to call that method … Continue reading

Posted in General .NET | Leave a comment

C# .NET Core Solr Search – Read from a Solr index

.NET Core has excellent support for doing searches in the Solr search engine. The search language is not always logical, but the search itself is manageable. Here’s a quick tutorial on how to get started. STEP 1: THE NUGET PACKAGES … Continue reading

Posted in General .NET | 1 Comment

Write to file from multiple threads async with C# and .NET Core

There are several patterns on how to allow multiple threads to write to the same file. the ReaderWriterLock class is invented for this purpose. Another classic is using semaphors and the lock statement to lock a shared resource. This article … Continue reading

Posted in .net, .NET Core, c#, General .NET | Tagged , , , , | Leave a comment

Azure Cognitive Search from .NET Core and C#

The Azure Cognitive Search engine is the search of choice in the Microsoft Azure. The search engine can be used in a myriad of ways and there are so many options that it can be difficult to find a starting … Continue reading

Posted in .NET Core, c#, General .NET, Microsoft Azure | Tagged , , , | Leave a comment

Programmatically create and delete Azure Cognitive Search Indexes from C# code

Azure Cognitive Search is the search engine of choice when using Microsoft Azure. It comes with the same search features as search engines like Elastic Search and SOLR Search (you can even use the SOLR search query language). One cool … Continue reading

Posted in General .NET | 1 Comment