How avoid a common mistake configuring mocks to return changing values

Introduction

Moq is a great mocking framework for .NET. I use it by default in all my .NET work. However, occasionally it can cause confusion, in particular when you are new to Moq. …


How to run and use the CosmosDB Emulator in Linux containers on Windows, MacOS or Linux

In this article we cover:

  • How to set up a containerized dev environment for CosmosDB development.
  • How to configure the new CosmosDB emulator in a Linux container (yes, this runs on Windows and MacOS…


Introduction

My past articles here on Medium covered fairly low-level topics, more in the form of Lego blocks that can be used as elements for building larger components. For example, we looked at how to use transactions with NHibernate. We also introduced dependency injection (DI) with Autofac.

In this article, we…


Introduction

How fast is the test suite for your backend? Can you run 10,000 tests per minute on a laptop? If you can’t then in this article, we will look at techniques that will assist getting towards that speed. …


In this article:

  • Benefits of Dependency Injection (DI) and Inversion of Control (IoC)
  • What is the problem to be solved?
  • Basic DI concepts
  • DI in a console application
  • Autofac in an ASP.NET web application in .NET 5.0

Introduction

As software engineers we are continuously tackling complexity. Any technique that makes our…


A todo-list can have many to-do list items

In this article:

  • Adding a test
  • Extending the domain model
  • Updating the object-relational mapping code
  • Resolving common NHibernate and database exceptions
  • Lazy Loading
  • Simplifying mapping code by using conventions

Introduction

Recap

In previous articles, we introduced NHibernate as the Object-Relational Mapper (ORM) to access data in a relational database. We then added…


Keeping your data consistent while avoiding code duplication

Boilerplate Code for Transactions

In this article:

  • What is a transaction?
  • Transactions in NHibernate
  • Rolling back transactions
  • Removing duplicated boilerplate code
  • Some house keeping

Introduction

Recap

In the previous article we introduced NHibernate as the Object-Relational Mapper (ORM) to access data in a relational database. We managed to…


Storing and reading data in a relational database without writing SQL

Repository using NHibernate

In this article:

  • At the beginning there was a test: Using Test-Driven Development (TDD)
  • A simple domain class
  • Using an object-relational mapper (ORM): NHibernate
  • Mapping classes to tables with Fluent NHibernate
  • Using the repository pattern to encapsulate database access

Introduction

Recap


Changing the target framework and other dev environment improvements

Source: https://devblogs.microsoft.com/dotnet/introducing-net-5/

In this article:

  • Changing the .NET SDK to .NET 5.0
  • Adding a missing tool required by some VS Code extensions
  • Adding an entrypoint script to improve running as non-root
  • Installing dotnet-outdated-tool for keeping nuget packages up-to-date
  • Switching the target framework to…


In this article:

  • Finding the Root Cause for issues with mounting an NTFS folder into a dev container when using WSL2
  • Installing Windows Subsystem for Linux, version 2 (WSL2)
  • Installing Linux distro in WSL2
  • Configuring git for use in Linux distro
  • Launching VS Code in Linux distro
  • Launching and connecting…

Manfred Lange

I’m a Principal Consultant at boutique firm HYPR Innovation in New Zealand. Currently, my main focus is helping clients to build scalable SaaS products.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store