Category Archives

Archive of posts published in the category: Coding

Proxy handling casting in C#

Let’s start with the following code: public interface IHaveASandwich { void Foo(); } public class ASandwichProvider : IHaveASandwich { public void Foo() { Console.WriteLine(“ASandwichProvider — Foo”); } public void Bar() { Console.WriteLine(“ASandwichProvider — Bar”); } } public class Service { public void DoSomethingWithSandwich(IHaveASandwich…

ILP Part 47 — Battleship puzzle

This is the forty seventh part of the ILP series. For your convenience you can find other parts in the table of contents in Part 1 – Boolean algebra Today we are going to solve Battleship puzzle. It is very similar to nonograms…

Turning on Redis in Sitefinity in Azure

Last time we saw how to change database connection string for Sitefinity which can be useful if we need to extract it in runtime. In the same manner we can enable Redis which is required when running Sitefinity in Azure (and is not…

Dynamically changing database connection string in Sitefinity

Sitefinity stores its database connection string in App_data\Sitefinity\Configuration\DataConfig.config so you can easily modify connection string there. But what if you want to extract the connection string in runtime? E.g., you want to read it from Azure Key Vault after application is started? First,…

Dependency injection in Sitefinity

In order to use DI in Sitefinity you need to configure two mechanisms. One for feather widgets and one for other stuff. Let’s begin with widgets. Feather widgets We would like to have dependencies injected to widgets’ controllers (using constructor). Sitefinity uses NInject…

Capturing Sitefinity logs and pushing them to Azure Storage

Let’s assume that we have properly configured Sitefinity instance to work in Azure (which includes using Azure SQL database and Azure Redis instance). Now there is a question: how do we capture logs and send them to Azure Storage? By default Sitefinity logs…

SQLxD Part 23 — Query parser tests

This is the twenty third part of the SQLxD series. For your convenience you can find other parts in the table of contents in Part 1 – XML Transformation Here go the tests for query parser: using System; using FluentAssertions; using Model; using…

SQLxD Part 22 — Query parser

This is the twenty second part of the SQLxD series. For your convenience you can find other parts in the table of contents in Part 1 – XML Transformation For parsing queries we use IronPython. Let’s begin with C# code for executing PLY…

SQLxD Part 21 — SELECT

This is the twenty first part of the SQLxD series. For your convenience you can find other parts in the table of contents in Part 1 – XML Transformation We have all things to transform rows and columns. Now it is time to…

SQLxD Part 20 — Transformers

This is the twentieth part of the SQLxD series. For your convenience you can find other parts in the table of contents in Part 1 – XML Transformation We can extract nodes, transform them into rows, filter, join, group, order, and transform them.…

SQLxD Part 19 — Expressions tests

This is the nineteenth part of the SQLxD series. For your convenience you can find other parts in the table of contents in Part 1 – XML Transformation Last time we implemented expressions, it is high time to test them: using Model; using…

SQLxD Part 18 — Expressions

This is the eighteenth part of the SQLxD series. For your convenience you can find other parts in the table of contents in Part 1 – XML Transformation Last time we saw tests for aggregates. Today we are going to implement expressions. We…

SQLxD Part 17 — Tests for aggregates

This is the seventeenth part of the SQLxD series. For your convenience you can find other parts in the table of contents in Part 1 – XML Transformation Last time we implemented aggregates, today we test them. Here are the snippets: using Model;…

SQLxD Part 16 — Aggregates

This is the sixteenth part of the SQLxD series. For your convenience you can find other parts in the table of contents in Part 1 – XML Transformation Today we implement various aggregates. Let’s start with the interface: using Model; namespace QueryLogic.Aggregates {…

SQLxD Part 15 — Ordering

This is the fifteenth part of the SQLxD series. For your convenience you can find other parts in the table of contents in Part 1 – XML Transformation Last time we implemented grouping, today we focus on ordering. These two operations are very…

SQLxD Part 14 — Grouping

This is the fourteenth part of the SQLxD series. For your convenience you can find other parts in the table of contents in Part 1 – XML Transformation Today we implement grouping. Since we can group in multiple ways, we need to have…

SQLxD Part 13 — Natural join

This is the thirtieth part of the SQLxD series. For your convenience you can find other parts in the table of contents in Part 1 – XML Transformation We mentioned the natural join a few times and it finally the part when we…

SQLxD Part 12 — JOINs tests

This is the twelfth part of the SQLxD series. For your convenience you can find other parts in the table of contents in Part 1 – XML Transformation Let’s implement tests for joins: using System; using System.Collections.Generic; using System.Linq; using Model; using NUnit.Framework;…

SQLxD Part 11 — JOINs

This is the eleventh part of the SQLxD series. For your convenience you can find other parts in the table of contents in Part 1 – XML Transformation Today we implement various JOIN operators. Let’s start with interfaces: using QueryLogic.RelationProviding; namespace QueryLogic.Joins.Abstraction {…

SQLxD Part 10 — WHERE and tests

This is the tenth part of the SQLxD series. For your convenience you can find other parts in the table of contents in Part 1 – XML Transformation Today we are going to test our code. First, we need to have some mocks:…