Author Archives: briancaos

About briancaos

Developer at Pentia A/S since 2003. Have developed Web Applications using Sitecore Since Sitecore 4.1.

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

Sitecore 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 configuration setting (and can be negated with … Continue reading

Posted in Sitecore, Sitecore 6, Sitecore 7, Sitecore 8, Sitecore 9 | 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

Sitecore AccessResultCache cache is cleared by Sitecore.Caching.Generics.Cache`1+DefaultScavengeStrategy[[Sitecore.Caching.AccessResultCacheKey

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 Sitecore.Caching.Generics.Cache`1+DefaultScavengeStrategy[[Sitecore.Caching.AccessResultCacheKey, Sitecore.Kernel, Version=11.1.0.0, Culture=neutral, PublicKeyToken=null]] strategy. Cache running size was xxx MB. This message can easily appear once every … Continue reading

Posted in Sitecore 6, Sitecore 7, Sitecore 8, Sitecore 9 | 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

Simple 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 methods in this NuGet package: Microsoft.Extensions.Caching.Memory … Continue reading

Posted in .net, .NET Core, c# | 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