Tell, don’t Ask

The most languages i develop in these days are OOP (Object Oriented Programming) languages and i try to use the SOLID-principles as much as possible. The first principle in SOLID is the Single Responsibility Principle (SRP), which states that a class should have only one reason to change. In other words, it should only have […]

Custom MVC validation attribute

Finding my self in a new-old situation i needed to create a custom validation attribute. To create an custom validation attribute we inherit from the abstract class “ValidationAttribute” in System.ComponentModel.DataAnnotations. This allows for server side validation by invoking the method “IsValid”. I decided to implement an “MoreThan” attribute which checks that the one value in my […]

Create self signed certificate

Today i started a project what utilized IdentityServer and for that i needed a signed certificate. This post might not be the best explained, but more like a reminder for my self.


Testing DBContext migrations

Today i was creating EntityFrameworkCore DBContexts and it’s a time consuming work to delete the databases, add migrations and then update the database to see what the migration scripts would generate. I created a simple powershell-script that i ran when needed.

To find the instance pipe name of the LocalDB i used the sqllocaldb […]

State pattern in C#

The state design patterns is a behavioral pattern that implements a state machine in an object-oriented way. It allows an object/class to alter its behavior when its internal state changes. Lets say that we have a competition application that allows clients to register score, but only when the competition is open. A non state pattern design […]

Kill Linux processes

We have an old messy thirdparty application at work that uses Oracle. Sometimes the application tends to lock the Oracle system and use a LOT of threads, leaving the system pretty much unresponsive. To be able to kill all 1000+ Oracle-plus processes i created a small script that kills all processes.

Shrink transactionlogs

To shrink the MS-SQL transactionlogs for emergency storage needs we can use the following syntax.

Use at your own risk.

Tablecopy with T-SQL

Today i found myself in a situation where i needed to copy some data from one table on a MS-SQL server to another. I found the following T-SQL syntax to be very helpfull.

Use at your own risk.