Resolve Open Generics with ASP.NET Cores DI-Container

ASP .NET Core already has quite a decent di-container built in. However, there are some quirks you might need to be aware of. In one of my applications, I’ve been using a factory pattern to register my views by using open generics. To be more clear about that: I have an Interface IView<TView>, and I want to register all of this interfaces implementations. As I found out, Microsofts DI-Container currently doesn’t support that by default (text me if I’m wrong!), but there’s a solution for this problem. Scrutor is a package that adds more complex di-features - specifically scanning. This means that, using this library, you now have the ability to scan through your assemblies and perform registrations based on your findings. ...

November 10, 2020 · 2 min · Marcel Jurtz

Domain Redirection with .htaccess and PHP

I’ve been starting a new blog on my domain, for which I wanted to use the ‘blog’ subdomain. However, this subdomain was already in use for all my coding-related stuff. So, I decided to move my current blog from /blog to /coding and upload my new blog to /blog. So far, so good. Now I have both of my blogs up and running. There’s just one problem: Any incoming traffic to existing posts on my blog would resolve to 404s. In todays post, I’m gonna show you how I resolved that issue. ...

November 7, 2020 · 2 min · Marcel Jurtz

FluentValidation in ASP.NET Core

Have you been implementing the validation of your ViewModels in ASP.NET (Core) using DataAttributes so far? If so, chances are you’ve always been dissatisfied because your classes became messy and full of unnecessarily replicated code. Yes? Then today’s post is for you. FluentValidation FluentValidation is a way to define strongly typed validation for classes in the form of a Fluent API. The term fluent in this case refers to a code structure where a function always return the modified object. This way, you can chain together multiple method calls and produce very readable source code, especially in configurations where it is often used. You may already be familiar with this structure from areas like the ASP.NET setup or LINQ. ...

October 5, 2020 · 4 min · Marcel Jurtz

How to create a profile README for GitHub

GitHub has been secretly pushing out a new feature in early july, that allows you to create a profile-level README-file. In todays post, I’ll be showing you, how you can create your own profile README to customize your own profile page according to your preferences. First of all, you won’t find this feature in your settings. To get started, you have to create a new repository with the same name as your username. For example, my GitHub username is “MarcelJurtz”, so I’m creating a new (public) repository named “MarcelJurtz”. After entering the name, the website already shows a hint that I’ve discovered a new feature. ...

August 22, 2020 · 1 min · Marcel Jurtz

Editing Zwift Workouts in C#

I’ve been using Zwift pretty extensively for the last few months. For anyone unfamiliar: Zwift is a VR Biking platform. That means, you can put your bike on a smarttrainer, connect it to your pc (directly via ant+ / ble or by bridging with your phone), and then you can ride virtual worlds without having to go outside. Sounds not too bad, right? After a few sessions, just riding became kind of tedious, so I’ve tried to do some of the preconfigured workouts. You can either do workouts by themselves or follow a trainingplan, which consists of multiple workouts that you have to complete to a given date. The workouts all have the same structure. They consist of different blocks, that can have a variety of requirements. The blocks that are available are either steady pedaling, ramps (up or down) or intervals (alternating steady blocks of high and low power which are repeated to a predetermined extent). Basically, there are some more types, but we’ll get back to that later. Let’s take a look at one of these workouts for example. ...

April 19, 2020 · 12 min · Marcel Jurtz