HTML Formatting in .NET Resource Strings

HTML Formatting in .NET Resource Strings

Whilst working on a client website, and I was adding content to the page based on the provided mockups and designs. All was going fine except for one part – a few paragraphs of content had formatting in the middle. Some had bold words, some had links etc. This was a problem because I was storing all content in resource strings to allow for easier localisation. One solution is to split the content into multiple parts, and you can apply…

Read More Read More

Debugging Microservices with Docker Compose and HAProxy

Debugging Microservices with Docker Compose and HAProxy

When working on a system recently, we had a problem where depending on the area we were working in, we had to remember to run all the different components necessary. Running one service meant we may also have needed to run our authentication service, a MongoDb instance, and another one or two services. That’s a lot to remember, and a lot that I don’t really care about – I only want to work on one of those. To get around this…

Read More Read More

Rendering Emails with RazorViewEngine in .NET Core 2.0

Rendering Emails with RazorViewEngine in .NET Core 2.0

In this post I’m going to cover how to use the RazorViewEngine to render Views, and get the string content so it can be used as an email template. As always, the code for this example can be found on Github here. This has been done in .NET Core 2.0, and I’ve created this on my Mac – though being .NET Core it works equally well on Windows (tested on my Surface Pro), and in theory should on Linux too….

Read More Read More

C# Unit Of Work Pattern with Dapper

C# Unit Of Work Pattern with Dapper

UPDATE: The code here is based on an existing example on GitHub by Tim Schreiber, you can find the original code here. At work I’ve started looking into using Dapper instead of Entity Framework. In our case, this is because of performance – we’re on EF 6, not Core (and Dapper is faster still over EF Core even). I’ve found it really easy to get started with, given there’s very little that Dapper makes you do that you weren’t already…

Read More Read More

Azure Service Bus Listener with Azure Service Fabric

Azure Service Bus Listener with Azure Service Fabric

Starting to play around with Azure Service Fabric, and one of the things a friend wanted to do was to be able to listen for messages on a service bus, and handle messages doing some work with file processing and blob storage. Doing this in Service Fabric would easily enable such a thing with massive scale, so I thought I’d take a look at laying out the basics for him. As such, this blog post is going to cover the…

Read More Read More

Reducing Consumed Request Units in DocumentDb with C# .NET

Reducing Consumed Request Units in DocumentDb with C# .NET

I’ve previously covered getting up and running with DocumentDb. Since then, one of the things I’ve been looking at with it is how to reduce the amount of request units each write operation to the database consumes. This post will be assuming you’ve got that code, as we’ll be building on it here. First, it’s good to understand what throughput you’ve set your collection to have, and what this means in terms of performance as you scale. Azure lets you…

Read More Read More

Getting Started with DocumentDb and C# .NET

Getting Started with DocumentDb and C# .NET

One of the things I’ve been playing around with recently is an Azure hosted DocumentDb – coincidentally it’s also my first foray into NoSQL databases! In this post I’ll be covering the basics of getting up and running with DocumentDb based on what I’ve encountered so far. To do this, we’re going to use a basic Console application, and through this we’ll create and read a new database, document collection, and documents themselves. First, we need to make sure everything…

Read More Read More

Give your Web API some Swagger with Swashbuckle

Give your Web API some Swagger with Swashbuckle

At work I’m currently working on my very first Web API using .NET Core. As part of this, we wanted to set it up to follow the OpenAPI specification, and provide a tool for other developers here to quickly find out more about the API and test some basic use cases. Swagger seemed like a good answer to all this, and fortunately there’s even a ready to go implementation for .NET called Swashbuckle. In this post I’ll cover the basics…

Read More Read More

Bubble Sort and Quick Sort with C#

Bubble Sort and Quick Sort with C#

One of the most common questions you get asked in technical interviews (as happened to me recently!) is to describe a sorting algorithm, so it’s good to have a couple up your sleeve. In this post I’ll cover two of the most common sorting algorithms, bubble sort and quicksort, and their implementations in C# – and as usual, you can find all the source code on Github here. I’ll try and cover some other sorting algorithms in a future post. Bubble…

Read More Read More

Introduction to Inversion of Control in C# with Dry IoC

Introduction to Inversion of Control in C# with Dry IoC

Recently I’ve been brushing up on some basic skills, and dependency injection with Inversion of Control is one of those things. Previously when doing this, I’ve stuck to the most commonly used variations of IoC with .NET – Unity and Ninject. However, after coming across this GitHub example I wanted to give Dry IoC a try given it’s performance benefits over most others. All this code can be found on my GitHub account here. The most basic use case of…

Read More Read More