I post .NET / C# and Visual Studio content on LinkedIn and X/Twitter almost daily. Please consider following me. LinkedIn … Continue reading Please follow me on X/Twitter and LinkedIn for more .NET content
How to install Scalar in .NET 9
I’m guessing you know what Scalar is if you’ve arrived here so let’s just look at the code to implement … Continue reading How to install Scalar in .NET 9
Visual Studio .http file request variable example
Request variables store values from a response for use in later requests. A common example is retrieving a Bearer token … Continue reading Visual Studio .http file request variable example
How to add SwaggerUI back into a .NET 9 Web API project
Swashbuckle.AspNetCore (including SwaggerUI) has been removed from the Web API template in .NET 9. Since the Swashbuckle project is being … Continue reading How to add SwaggerUI back into a .NET 9 Web API project
Monitor Visual Studio Dev Tunnel traffic in real-time
Visual Studio Dev Tunnels make testing integration with third party webhooks so easy, but is there a way to inspect … Continue reading Monitor Visual Studio Dev Tunnel traffic in real-time
Getting started with Visual Studio 2022 Dev Tunnels
Visual Studio Dev Tunnels are available from VS 2022 v17.6 and allow us to expose and debug our localhost APIs … Continue reading Getting started with Visual Studio 2022 Dev Tunnels
Handling GitHub Webhooks with Azure Functions and testing integration with Visual Studio Dev Tunnels
GitHub can send our apps a webhook message for a variety of events that may happen on a repo such … Continue reading Handling GitHub Webhooks with Azure Functions and testing integration with Visual Studio Dev Tunnels
Numerical StringComparer coming in .NET 10
This enables comparisons of numbers based on their numerical value instead of lexicographical order. In the example below with Ordinal … Continue reading Numerical StringComparer coming in .NET 10
ASP.NET IOptions pattern example
IOptions<T> gives us compile-time safety and eliminates magic strings.Simple example below : Click on the image for a larger view … Continue reading ASP.NET IOptions pattern example
In a REST API should we return 204 (No Content) or 404 (Not Found) for a HTTP DELETE request when the item to delete is already deleted?
I took polls on my LinkedIn and X asking about what we should do in the scenario where we have … Continue reading In a REST API should we return 204 (No Content) or 404 (Not Found) for a HTTP DELETE request when the item to delete is already deleted?
ASP.NET Rate Limiting middleware simple examples
Since .NET 7, ASP.NET has built-in middleware for rate limiting our API endpoints. Once we understand the different rate limiting … Continue reading ASP.NET Rate Limiting middleware simple examples
When to avoid ToList() / ToListAsych() in Entity Framework?
I had two people (including the person below who blocked me for my response) tell me using ToList() was wrong … Continue reading When to avoid ToList() / ToListAsych() in Entity Framework?
View Entity Framework DB query plans directly inside Visual Studio
This relatively new EFCore.Visualizer Visual Studio extension looks like it could be a game changer. It enables us to view … Continue reading View Entity Framework DB query plans directly inside Visual Studio
What are Discriminated Unions?
Discriminated Unions allow us to tell the compiler that data can be ONE OF A RANGE of pre-defined types. A … Continue reading What are Discriminated Unions?
Discriminated Unions in C# design update (Jan 2025)
Looks like DUs might be delivered partially over multiple versions of C# starting with Union classes based on a design … Continue reading Discriminated Unions in C# design update (Jan 2025)
.NET 10 will support OpenAPI v3.1
Safia from Microsoft posted this on BlueSky recently … This is great news but based on what she also posted … Continue reading .NET 10 will support OpenAPI v3.1
Return ProblemDetails from ASP.NET 8 IExceptionHandler global exception handler
IExceptionHandler allows us to globally handle exceptions in our ASP .NET 8 UI and API based apps. Here’s an example … Continue reading Return ProblemDetails from ASP.NET 8 IExceptionHandler global exception handler
Setting default global configuration for .NET types in Entity Framework
By default Entity Framework converts strings to nvarchar(MAX) in SQL Server which isn’t ideal. We can configure this mapping in … Continue reading Setting default global configuration for .NET types in Entity Framework
How to make strings non-Unicode in Entity Framework Code First
By default Entity Framework will convert string properties to nvarchar(MAX) or nvarchar(123) where 123 is the length we have set … Continue reading How to make strings non-Unicode in Entity Framework Code First
Difference between const and readonly in C#
The const and readonly keywords in C# are used to declare variables that cannot be changed after they are initialized. … Continue reading Difference between const and readonly in C#
How to auto include navigations in Entity Framework
Normally if we want to include certain navigation properties we have to explicitly do it on a query by query … Continue reading How to auto include navigations in Entity Framework
Entity Framework DB First quick start using EF Core Power Tools
It’s simple enough to get started with the Entity Framework Database First approach using the command line, but it’s even … Continue reading Entity Framework DB First quick start using EF Core Power Tools
Include sensitive data in Entity Framework logging by setting EnableSensitiveDataLogging
When we turn on logging in Entity Framework, by default it won’t output sensitive information such as query parameter values … Continue reading Include sensitive data in Entity Framework logging by setting EnableSensitiveDataLogging
Entity Framework FromSqlInterpolated examples
The FromSqlInterpolated method in Entity Framework Core is used to execute a raw SQL query that contains interpolated parameters. Interpolated … Continue reading Entity Framework FromSqlInterpolated examples
GitHub examples of .NET method usages visible in Visual Studio from 17.6+
From Visual Studio 2022 17.6 we’ll be able to see real world examples of common .NET APIs on GitHub direct … Continue reading GitHub examples of .NET method usages visible in Visual Studio from 17.6+
Simple string concatenation using String.Create and other performance sensitive approaches in .NET 8
I posted my previous simple string concatenation benchmark results where I was concatenating my name with spacer on Reddit recently. … Continue reading Simple string concatenation using String.Create and other performance sensitive approaches in .NET 8