Sitecore LinkField TargetItem is NULL – what’s wrong?
An ancient topic, that pops up once or twice every year. The TargetItem of Sitecore.Data.Links.LinkField returns NULL and you are CERTAIN that the item is published. What to do? CASE 1: THERE IS...
View ArticleProgrammatically 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...
View ArticleAzure 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...
View ArticleHttpClient retry on HTTP timeout with Polly and IHttpClientBuilder
The Polly retry library and the IHttpClientBuilder is a match made in heaven as it defines all the retry logic at startup. The actual HttpClient calls are therefore untouched by any retry code. The...
View ArticleWrite 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...
View ArticleC# .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...
View ArticleC# 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:...
View ArticleSimple C# MemoryCache implementation – Understand the SizeLimit property
The .NET Core IMemoryCache is probably the simplest cache there is, and it is very easy to use, once you get your head around the weird SizeLimit property. Especially when using the nice extension...
View ArticleC# 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...
View ArticleSitecore AccessResultCache cache is cleared by...
Are you getting a lot of these messages in your Sitecore log: 6052 2021:03:25 05:23:12 WARN AccessResultCache cache is cleared by...
View ArticleHandling “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”: 415 Unsupported...
View ArticleSitecore 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...
View ArticleC# 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): using System; using System.Linq;...
View ArticleSitecore KeepLockAfterSave – Configuring Security Policies Per-Role Based
Now here is a nifty Sitecore trick. You have probably learned about the AutomaticLockOnSave feature that allows Sitecore to lock an item when it is saved. The feature is enabled or disabled using...
View ArticleC# 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...
View Article.NET Core QueueMessage JSON to Typed Object. Using Azure.Storage.Queues
The documentation around .NET QueueMessage is a little fuzzy so depending on the version of your NuGet libraries might differ in properties. This article uses the Azure.Storage.Queues,...
View ArticleRead from Azure Queue with .NET Core
The documentation around Azure Queues and .NET Core is a little fuzzy, as the approach have changed slightly over the last updates. Previously you had a shared Storage Account NuGet Package that gave...
View ArticleRead and Write blob file from Microsoft Azure Storage with .NET Core
The documentation on the Azure Storage Blobs are a little fuzzy, as the NuGet packages and the approach have changed over time. The latest NuGet Package is now called: Azure.Storage.Blobs The concept...
View ArticleC# Remove Duplicates from List with LINQ
C# LINQ do have a Distinct() method that works on simple types: // An string with non-unique elements string s = "a|b|c|d|a"; // Split the list and take the distinctive elements var distinctList =...
View ArticleCreate a custom Azure Dashboard Tile Using an Azure Function and Markdown Format
The tiles on an Azure Dashboard will only display data from Azure itself. So if you have data from the outside, like a database, you need to make a few workarounds. Tiles of an Azure Dashboard Now,...
View Article