.NET: use a preview version in your global.json

.NET: use a preview version in your global.json

We are currently in the preview phase of .NET 9, which releases in Nov 2024 - and if you want to test it extensively like I do, store the preview ver

Efficiently clean a string with .NET

Efficiently clean a string with .NET

Strings are one of the most commonly used types in .NET applications - and very often the source of inefficient code. For example, cleaning up a stri

Refit .NET - my personal caller best practise

Refit .NET - my personal caller best practise

Refit is an open-source library for .NET developers that simplifies the process of making HTTP API calls. It allows developers to define a set of int

Strong Name Sign .NET Assemblies via SNK

Strong Name Sign .NET Assemblies via SNK

Strong Name Signing is a mechanism in .NET development that ensures the integrity and authenticity of assemblies. It is based on a public-private key

Handle Yaml Files with .NET

Handle Yaml Files with .NET

YAML files are unfortunately part of everyday life for all developers these days; and although they are very error-prone and almost impossible to edi

Welcome to the new Visual Studio SLNX Solution File

Welcome to the new Visual Studio SLNX Solution File

For many years, there has been a lot of criticism of Visual Studio's current solution format. It is very difficult to read, it does not follow any st

Enable NuGet Audit for better DevSecOps in .NET

Enable NuGet Audit for better DevSecOps in .NET

Auditing is becoming increasingly important in the everyday life of a developer; however, until now there was no particularly good way in .NET - even

ASP.NET Core Form protection with Cloudflare's Turnstile

ASP.NET Core Form protection with Cloudflare's Turnstile

TLDR; You can see the full sample in my GitHub repository BEN ABT Samples - ASP.NET Core Form protection with Cloudflare's Turnstile Turnstile is a

Use GitHub Copilot Chat in Visual Studio to solve the .NET Moq drama and migrate to NSubstitute

Use GitHub Copilot Chat in Visual Studio to solve the .NET Moq drama and migrate to NSubstitute

It's now been a few months since the GDPR-drama and data-harvesting around Moq (Stop using Moq as a guinea pig to get feedback on and develop Sponsor

.NET Event Counters

.NET Event Counters

.NET event counters are a relatively new API for collecting metrics from .NET applications. They are part of the EventSource and EventCounter namespa

Top 5 Git Commit Message Best Practises in 2024

Top 5 Git Commit Message Best Practises in 2024

When you join a project as a new developer, you see one thing above all: no standards for Git commit messages. Some put emojis in the message, others

Custom Azure Application Insights Telemetry Metrics with .NET

Custom Azure Application Insights Telemetry Metrics with .NET

By default, Azure Application Insights comes with necessary and important telemetry capabilities to monitor the basic functions of an application and

Azure Communication Service - .NET Client with Managed Identity

Azure Communication Service - .NET Client with Managed Identity

The Azure Communication Service is a fairly new but already popular service for sending emails at scale. In this article, I would like to show you ho

Azure Communication Service - .NET Client with ConnectionString

Azure Communication Service - .NET Client with ConnectionString

The Azure Communication Service is a fairly new but already popular service for sending emails at scale. In this article, I would like to show you ho

Header and Footer Layouts with Handlebars.NET

Header and Footer Layouts with Handlebars.NET

One of the last blog posts (Text and EMail Templates with Handlebars.NET) was generally about HandleBars.NET - a very popular template engine. This p

.NET Naming Best Practises: API Models

.NET Naming Best Practises: API Models

API models are one of the elements where I personally see the most naming errors - which have a massive impact on the architect and cause subsequent

.NET Naming Best Practises: Services vs. Providers

.NET Naming Best Practises: Services vs. Providers

In many code bases there are Services and Providers - and often they do the same thing structurally; but what is the idea of a Service- and Provider-

.NET Naming Best Practises: Database Entities

.NET Naming Best Practises: Database Entities

Database entities are the objects that represent the tables in your database. They are the objects that you use to read and write the database. Namin

.NET Naming Best Practises: DTOs

.NET Naming Best Practises: DTOs

Often seen, often used incorrectly: DTOs. Data Transfer Objects. In principle, DTO is an umbrella term, a design pattern that is used to transfer dat

Text and EMail Templates with Handlebars.NET

Text and EMail Templates with Handlebars.NET

A frequent requirement in apps is the conversion of templates, e.g. for sending e-mails, for PDF templates or other text modules. There are many diff

Create QR Codes with .NET

Create QR Codes with .NET

QR codes are a simple and very popular way of exchanging data and information - even in .NET. They have become part of everyday life. Unfortunately,

Deploy ASP.NET Core via Zip Deployment to Azure Web App

Deploy ASP.NET Core via Zip Deployment to Azure Web App

There are various ways to deploy an application, but Zip deployment is the variant that is recommended the most - regardless of whether you are using

New Data Annotation attributes with .NET 8

New Data Annotation attributes with .NET 8

With .NET 8, the System.ComponentModel.DataAnnotations Namespace has been revised and some new attributes have been added that have been requested by

The well-structured Entity in EF Core

The well-structured Entity in EF Core

A database entity represents an identifiable entry, often also things from the real world, which are to be stored and managed in the database. The pu

When to use optional arguments and parameter defaults in c#

When to use optional arguments and parameter defaults in c#

In C#, optional arguments are parameters in a method that have default values specified in the method's declaration. This means that when you call th

.NET 8 makes you faster. Everyday.

.NET 8 makes you faster. Everyday.

As has been the case for many releases, the .NET 8 team is spending a lot of development effort to improve the .NET Runtime in terms of performance.

Convert UnixTime to DateTimeOffset with a custom System.Text.Json Converter

Convert UnixTime to DateTimeOffset with a custom System.Text.Json Converter

Some APIs do not follow standards, ignore ISO8601 and return UnixTime. This is not nice, but can be easily fixed with a custom converter for System.T

Accelerate your .NET build with Visual Studio 2022

Accelerate your .NET build with Visual Studio 2022

A little more than three months ago, Microsoft integrated a new functionality into Visual Studio 2022: Build Acceleration. This mechanism, which can

Re-use EF Core Expressions to avoid redundant queries

Re-use EF Core Expressions to avoid redundant queries

I often see snippets in EF Core code reviews such as the following: dbContext.Users.Where( user => user.Id == id ); The query filter user => u

Easy InMemory Unit Tests with EFCore and Sqlite

Easy InMemory Unit Tests with EFCore and Sqlite

Unit testing is a type of software testing that is performed on the smallest unit of a software application, called a "unit". A unit can be

Better Code with custom Strong-Id Types

Better Code with custom Strong-Id Types

In many software architectures the problem exists that there are methods, which are specified a multiplicity of type-same parameters, whose meaning i

Value Converters in EFCore

Value Converters in EFCore

In the field of software development, data transformation plays a key role in ensuring that information flows seamlessly between different components

Simplify string formatting with SmartFormat.NET

Simplify string formatting with SmartFormat.NET

String formatting is a common task in software development and allows you to create dynamic and informative output. Traditional approaches such as st

Neuerungen in .NET 8

Neuerungen in .NET 8

Noch ein halbes Jahr bis zum Release von .NET 8 - Zeit sich anzuschauen, was wir neues erwarten dürfen. LTS Release .NET 8 ist erneut ein LTS-Release

Detect Windows 10 and Windows 11 with .NET

Detect Windows 10 and Windows 11 with .NET

Version numbers have always been a rather weird maintained matter under Windows; however, it became particularly bad with Windows 10, respectively 11

Efficient deserialization of Json files on Azure Blob Storage with .NET

Efficient deserialization of Json files on Azure Blob Storage with .NET

System.Text.Json is currently the most modern way to handle Json files efficiently. Efficiency here also means that memory sparing files are read in.

Microsoft has moved Teams backend service to .NET 6 - the performance results

Microsoft has moved Teams backend service to .NET 6 - the performance results

September last year, Microsoft announced that a large number of backend services would be migrated to .NET 6. This, they said, was an enterprise-wide

A struct with an interface is inefficient in .NET

A struct with an interface is inefficient in .NET

Structs have their advantages in .NET: they are especially efficient in the runtime if used correctly. But if you use structs with an interface, the

Difference of is null vs equals null and why is null is recommended

Difference of is null vs equals null and why is null is recommended

Both C# is null and == null are used to check if a variable or object is null, but they work slightly differently. is null checks if the variable or

Create Symbolic Links on Windows with .NET

Create Symbolic Links on Windows with .NET

Symbolic Links (often abbreviated as symlinks) are a type of file or folder shortcut in Windows that reference another file or folder in the file sys

Benefits of using isolated mode of Azure Functions with .NET

Benefits of using isolated mode of Azure Functions with .NET

The isolated mode of Azure Functions with .NET allows for greater control over the runtime environment and dependencies of the function. In this mode

Multi Query Selects with EF Core

Multi Query Selects with EF Core

Often there is a situation where you need to load several pieces of information from a database or table at the same time in order to display certain

Statische Methoden in C# / .NET

Statische Methoden in C# / .NET

Statische Methoden in C# sind Methoden, die auf eine Klasse und nicht auf eine bestimmte Instanz einer Klasse angewendet werden. Sie können aufgerufe

What is .NET and what is the difference to C#?

What is .NET and what is the difference to C#?

.NET and C# (CSharp) are two closely related technologies, but they are not the same thing. Understanding the difference between the two can be confu

Difference between Add and AddAsync in EF Core

Difference between Add and AddAsync in EF Core

Using Add or AddAsync in Entity Framework Core can be a little confusing, especially for those new to working with databases and ORMs (Object-Relatio

Test your .NET exceptions with FluentAssertions

Test your .NET exceptions with FluentAssertions

Testing exceptions in your code is an important part of ensuring that your code is robust and behaves correctly under various scenarios. One way to t

Get Process Id by Name or Path with .NET

Get Process Id by Name or Path with .NET

Getting the process ID by the name or path of a process can be useful for a variety of reasons, such as being able to kill a hanging process or check

Avoid Caching with MemoryCache and GetOrCreate in .NET

Avoid Caching with MemoryCache and GetOrCreate in .NET

GetOrCreate or its asynchronous counterpart GetOrCreateAsync is an extension method to create a cache entry if it does not exist yet. This method tak

Validate Configuration Options with ASP.NET Core

Validate Configuration Options with ASP.NET Core

Configuring an ASP.NET Core application can be done in a variety of ways, including using command-line arguments, environment variables, and JSON fil

What is a NullReferenceException in .NET and how can it be avoided?

What is a NullReferenceException in .NET and how can it be avoided?

A NullReferenceException is a common error that occurs in .NET applications when a null reference is accessed as if it were an object. This can happe

Create a Fulltext Catalog with EF Core .NET Migrations for MSSQL

Create a Fulltext Catalog with EF Core .NET Migrations for MSSQL

A full-text catalog in Microsoft SQL Server is a specialized storage that is used to store and manage full-text indexes for one or more tables in a d

Compile Linq Expressions to increase performance

Compile Linq Expressions to increase performance

Expressions are now an absolute part of a developer's everyday life in .NET thanks to Linq. However, due to their nature, expressions are not one of

DateTime vs. DateTimeOffset - UtcNow vs. Now

DateTime vs. DateTimeOffset - UtcNow vs. Now

.NET has two principal ways for handling times: DateTime and DateTimeOffset. The big deficit of DateTime, which was also recognized early in .NET 1.0

Microsoft is moving backend services to .NET 6

Microsoft is moving backend services to .NET 6

Microsoft has announced in an impressive blog post on the .NET DevBlogs that they have started an enterprise-wide migration to migrate backend servic

Health Check Ping with EF Core and MSSQL

Health Check Ping with EF Core and MSSQL

Sometimes it is quite useful to be able to send a query to the MSSQL server independently of its schema; for example to check if the server is princi

Why you should no longer use var in C#

Why you should no longer use var in C#

Beginning with C# 3, variables that are declared at method scope can have an implicit "type" var. An implicitly typed local variable is st

Parse HTML with .NET and the HtmlAgilityPack

Parse HTML with .NET and the HtmlAgilityPack

Parsing HTML with .NET can be a useful skill for any developer working on web applications or data analysis projects. One tool that can be particular

Use ASP.NET Core Options with an instance

Use ASP.NET Core Options with an instance

ASP.NET Core provides a built-in mechanism for configuring an application's options using the Options pattern. This pattern allows you to define a cl

Write Json Files asynchronously with .NET

Write Json Files asynchronously with .NET

Writing JSON files asynchronously is a useful technique for improving the performance and scalability of your application. By using an asynchronous a

Write XML Files asynchronously with .NET

Write XML Files asynchronously with .NET

Writing XML files asynchronously is a useful technique for improving the performance and scalability of your application. By using an asynchronous ap

ActivityPub Protocol

ActivityPub Protocol

ActivityPub is an open, decentralized social networking protocol that allows users to share content and interact with each other across the internet.

List local Windows Administator names with .NET

List local Windows Administator names with .NET

First, you need to install the NuGet Package System.DirectoryServices.AccountManagement Now you can open a context and get all members of the built-i

20th Year! Happy Birthday .NET!

20th Year! Happy Birthday .NET!

20 years ago today .NET was released! Congratulations - you are the best ecosystem!

Die .NET UI Technologie├╝bersicht 2022

Die .NET UI Technologieübersicht 2022

Windows Forms aka WinForms Windows Forms ist eine sehr stark veraltete Technologie, die Aufgrund ihrer Einfachheit jedoch immer noch sehr beliebt ist

Check for .NET NuGet Updates via dotnet outdated cli tool

Check for .NET NuGet Updates via dotnet outdated cli tool

.NET now has a very powerful CLI that can also handle NuGet packages very well. But one important feature is missing: check if there are package upda

DateTime vs DateTimeOffset - der richtige Umgang mit Zeiten in .NET

DateTime vs DateTimeOffset - der richtige Umgang mit Zeiten in .NET

Dieser Artikel behandelt den korrekten Umgang sowie Best Practises und Empfehlungen von Datums- und Zeitinformationen, Zeitzonen und Betriebssystem-E