Author: Dawid

Architecting WPF - Part 1 - Closer Look at MVVM pattern

I've been spending a lot of time learning about WPF recently and its chief design pattern: MVVM. It is partly work-related, as we've been doing some major backend refactoring and could take the advantage to change some of the front-end too. We've been gradually adopting WPF because apparently, Blazor and co. are still unproven to

Continue Reading

Why is primitive obsession still a thing? - .NET Perspective

Imagine, .NET didn't have DateTime struct, what would you do then? Sure, some of you would find a library (or write the library), but I bet most of the time, we would simply pass a date as a string or an int (e.g. epoch time). This is known as a primitive obsession. 4 Good Reasons

Continue Reading

SpecFlow tests for .NET Core Web Apps with Playwright

Specflow is a fantastic framework for codifying your requirements. It allows writing human-readable scenarios which map to C# code. This, coupled with a browser automation tool like playwright, puppeteer, or selenium can create an incredibly powerful and versatile testing framework. In this article, I’ll show you how to set up a basic test framework for

Continue Reading

Forcing Docker Swarms to update a service

Docker Swarms a much simpler alternative to Kubernetes, and yet they offer a surprising amount of capabilities. This is especially true when you consider docker-compose file can be deployed to a swarm. One of my favorites is the rolling updates. When deploying images to your docker repo, using the latest tag is the simplest and

Continue Reading

Nginx, how to split API and UI calls to separate containers

I tend to use Nginx as a reverse proxy in most of my pet projects. Nginx is very easy to set up, it works well on Linux and in the swarm. .NET apps have got a built-in server - Kestrel and many developers prefer to keep their API and UI in one container. I tend

Continue Reading

How to evenly space many inline-block elements?

flex can help to space out images inline-block elements. (JS Fiddle)

Continue Reading

System.IO.FileLoadException : Could not load file or assembly 'MongoDB.Driver.Legacy, Culture=neutral, PublicKeyToken=null'. Invalid pointer (0x80004003 (E_POINTER))

I setup a set of automated tests for one of my pet projects but annoyingly I came across the following error today: System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation. ----> System.IO.FileLoadException : Could not load file or assembly 'MongoDB.Driver.Legacy, Culture=neutral, PublicKeyToken=null'. Invalid pointer (0x80004003 (E_POINTER)) The solution is to install

Continue Reading

EF Core - empty inverse property list despite using Include and ThenInclude

Yesterday, I created a new project to play around with Blazor and .NET 5. However, my fun was cut short when EF Core refused to fetch dependent child properties. This is despite using eager loading with Include. Clean projects, unit tests, nullable reference types, init properties, the code was super simple with just 2 classes

Continue Reading

EF Core - using letters instead numbers for enums in the database

Sometimes, I actually prefer to store letters for rather than integers in the database. Yes, it can be less performant (as you do need to implement a custom converter), but can make the database a lot easier to read. Consider the example below that TradeDirection. It might be more preferable to see B and S

Continue Reading

Extremely simple Producer Consumer Pattern in C#

.NET has introduced a library called System.Threading.Tasks.Dataflow which is now included with .NET Core. Library contains BufferBlock<T> which is great data structure to implement an extremely simple Producer-Consumer pattern.

Continue Reading