Category Archives: c#

Sitecore get Context from fully qualified URL

One of the basic Sitecore concepts is the concept of a context. The context is resolved from the HTTP Context to Sitecore and determines the database, language, user domain, content start item etc. The context is defined in the App_Config/Sitecore.config … Continue reading

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

Deserialize XML array to string[] and how to allow JSON to be deserialized into the same POCO class

How do you deserialize the classic XML array to an string[] type? The XML representation of an array is a list of elements: And the MyArray would normally be deserialized to an annoying class: The solution is to use the … Continue reading

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

Read from Azure Queue with Azure WebJobs 3.0 and .NET Core

From WebJobs 2.0 to WebJobs 3.0 Microsoft have completely rewritten the way Azure WebJobs is used. The reasons are probably noble, but they require you to redo your work when upgrading. So I made this template that allows me to … Continue reading

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

Sitecore Pipelines – The great walkthrough

I have previously stated my enthusiasm for the Sitecore Pipeline concept. This article describes how to create your own, how to add parameters, and which properties to use. WHAT IS A SITECORE PIPELINE? It is best described as a simple … Continue reading

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

Sitecore disable automatic lock on create items

From Sitecore 9, Sitecore changed the default behavior when creating items in the content editor. As per default, any item is locked when created, and will only be unlocked if the user unlocks it, or the user saves the item, … Continue reading

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

Sitecore delete old item versions

Are your Sitecore editors version-trigger-happy? Is your master database items drowning in old versions that will never be used – or is just exact replicas of the previous version? Fear not, you can in fact – with a little bit … Continue reading

Posted in .net, c#, General .NET, Sitecore 5, Sitecore 6, Sitecore 7, Sitecore 8, Sitecore 9 | Tagged , , | 2 Comments

Serilog – Add thread ID to the log file

Serilog is more or less the default file logger when developing .NET Core applications. The simple logger can easily be modified to – for example – add the thread ID. FIRST THINGS FIRST: THE SERILOG NUGET PACKAGES You need these … Continue reading

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

Azure ApplicationInsights track custom metrics using the TelemetryClient

The Microsoft.ApplicationInsights nuget package is your code gateway to the Microsoft Application Insights portal, and also to the Azure Monitor universe. You use these tools as a shared place for your log data, telemetry, alerts, diagnostics etc. The Application Insights comes … Continue reading

Posted in .net, c#, Microsoft Azure | Tagged , , , , | Leave a comment

Azure Application Insights – Multiple services from same server

This trick enables you to have multiple services from the same server log to the same Application Insights instance, and at the same time distinguish between each service. In the example above, I have 2 services from the same server. … Continue reading

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

c# Async fire and forget

Often in application development you want a process to call another thread and continue the process flow, without waiting for a response from the called thread. This pattern is called the “fire and forget” pattern. I myself are oblivious to … Continue reading

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