Efficient file uploads with dotnet
Introduction Recently I needed to solve the following problem at work We need to upload a lot of large files to a third party storage provider, it needs to be as efficient as possible. This problem is...
View ArticleBeware of potential XSS injections when using ProblemDetails in ASP.NET Core
Photo by Elisa Ventur Introduction An old colleague of mine (Nils Stjernstrid) wrote to me a couple of weeks ago and told me that he wanted me to be aware of a potential problem with the default...
View ArticleHttpClient - DelegatingHandler - Correlation Id
Introduction We have multiple microservices in our stack that calls each other. When an error occurs, it's really nice to be able to correlate all the calls to see where something went wrong. Imagine...
View ArticleHow to test configuration of HttpClient when using AddHttpClient
Photo by Caspar Camille Rubin Introduction When you register your custom HttpClient using the AddHttpClient method, it's also quite common that you configure some basic settings like BaseAddress and...
View ArticleUsing embedded files in dotnet core
The problem We want to read a JSON file from disk in our application. We don't want to rely on absolute file paths, hosting environments, copying the files to the output directory etc. The JSON file...
View ArticleGotcha when using Postgres, NodaTime, Ef Core and Dapper
The problem We ran into an interesting bug last week at work. We have a simple ASP.NET Core API that talks to a Postgres database using EF Core (for writes) and Dapper (for reads). The following code...
View ArticleModel bind multiple sources to a single class in ASP.NET Core
The problem We have the following action method: [Route("[controller]")] [ApiController] [Produces("application/json")] public class HomeController : ControllerBase { public IActionResult Post(...
View ArticleWOPI Integration with ASP.NET Core - lessons learned
Photo by Nikhita S Introduction Recently I've been working on adding "Office for the Web" support to our system. This will enable us to edit office documents uploaded to our system directly in the...
View ArticleModel bind multiple sources to a single class in ASP.NET Core
The problem We have the following action method: [Route("[controller]")] [ApiController] [Produces("application/json")] public class HomeController : ControllerBase { public IActionResult Post(...
View ArticleWOPI Integration with ASP.NET Core - lessons learned
Photo by Nikhita S Introduction Recently I've been working on adding "Office for the Web" support to our system. This will enable us to edit office documents uploaded to our system directly in the...
View ArticleModel bind multiple sources to a single class in ASP.NET Core
The problem We have the following action method: [Route("[controller]")] [ApiController] [Produces("application/json")] public class HomeController : ControllerBase { public IActionResult Post(...
View ArticleWOPI Integration with ASP.NET Core - lessons learned
Photo by Nikhita S Introduction Recently I've been working on adding "Office for the Web" support to our system. This will enable us to edit office documents uploaded to our system directly in the...
View ArticleModel bind multiple sources to a single class in ASP.NET Core
The problem We have the following action method: [Route("[controller]")] [ApiController] [Produces("application/json")] public class HomeController : ControllerBase { public IActionResult Post(...
View ArticleUsing records when implementing the builder pattern in C#
Photo by Vitolda Klein I tend to use the builder pattern quite a bit when writing my tests. It's really convinient to create a builder and have a fluent interface when creating some test data. We'll be...
View ArticleDealing with access tokens in dotnet
Photo by Ashwini Chaudhary Introduction When working with http APIs you'll sooner or later run into access tokens. I will not go into any depth of the whys and the hows but let's do a quick breakdown....
View ArticleSorting (really) large files with C#
The problem Imagine the following (completely made up ofc, no one would ever use CSV files of this size, right?) scenario: Hello Josef! I need to get this CSV file sorted in ascending order ASAP before...
View ArticleSorting large CSV files by column using C#
Photo by Maksym Kaharlytskyi This is a follow up to my previous post about sorting (really) large files using c#. The problem We have the following CSV file:...
View ArticleJOS.Configuration - Convenient methods for configuration in dotnet core
Photo by Manik Roy I want my configuration objects to be plain pocos. I don't want to depend on the IOptions<ExampleOptions> pattern in my code, I want to inject the poco (without the IOptions...
View ArticleSorting large CSV files by multiple columns using C#
Photo by Alex Block This is a follow up to my previous post about sorting large files by column using c#. The problem We have the following CSV file: FirstName,LastName,Album,Attendance,City...
View ArticleBeware of potential XSS injections when using ProblemDetails in ASP.NET Core
Photo by Elisa Ventur Introduction An old colleague of mine (Nils Stjernstrid) wrote to me a couple of weeks ago and told me that he wanted me to be aware of a potential problem with the default...
View Article