AWS Lambda + Python + PIP Packages = true
Intro I'm in the process of moving all my stuff from Azure to AWS. One of the things I currently run in Azure is a twitter bot that tweets every hour (it even made the local news a couple of years...
View ArticleC# - Sealed and internal - how to use in unit test?
The problem I'm using the Firebase Admin dotnet sdk to send push notifications. They have the following method that allows you to send multiple notifications with one request: public async...
View ArticleCustomizing PropertyHandlers in JOS.ContentSerializer
The problem Imagine the following ContentType: public class PostPage : PageData { .... [Display(Order = 400)] [CultureSpecific] [AllowedTypes(typeof(AuthorBlock))] public virtual ContentReference...
View ArticleSwagger - Tips and Tricks - Part 2
Exclude certain properties from the Swagger UI The problem Sometimes you have some properties on your request model that you don't want to show in the Swagger UI, for whatever reason. The solution I'm...
View ArticleHow to configure Episerver to use Active Directory
This is a quick guide showing how to configure Episerver to use Active Directory instead of Multiplexing/WindowsProvider. This is NOT showing how to use Azure AD. Im testing this on a new Alloy site...
View ArticleBeware of Enum.TryParse
What do you think Enum.TryParse will return when running this code? public enum ContactMethod { Unknown = 0, Email = 1, Phone = 2 } var result = Enum.TryParse("10", out ContactMethod contactMethod);...
View ArticleHeadless Episerver? Meet JOS.Epi.ContentApi
I read this blog post by Mathias Kunto where he says that he will leave my beloved library behind and start using the new Episerver Headless API instead. I felt like the picture above :( I couldn't...
View ArticleJOS.Epi.ContentApi updated to version 3.0.0
Thanks to the discussion in the comments on the blogpost written by Johan Björnfot I could simplify the code a lot and remove the HttpModule. Version 3.0.0 is now available on the nuget feed. It's a...
View ArticleGet dot-notation of C# property/member
The problem Validate incoming API calls and return nice errors if some property failed to validate. Example: public class AuthorInput { public NameInput Name { get; set; } } public class NameInput {...
View ArticleYou're (probably still) using HttpClient wrong and it is destabilizing your...
Required reading before reading this blog post: You're using HttpClient wrong and it is destabilizing your software TL;DR Don't use .Result. Stream the response instead of storing the whole response in...
View ArticleLet's talk about mapping objects in c-sharp (C#)
Intro In this post I will focus on two things: Why should we map our models (database, external api dtos...) to a different object before exposing the data in a API response? How do we map our models?...
View ArticleASP.NET Core - Protect your API with API Keys
Disclaimer There's a bunch of different ways to handle authentication/authorization. As pointed out here on Twitter by Greg Bair, API keys has some limitations/drawbacks. One problem is that usually...
View ArticleDotnet Core - Filter out specific test projects when running dotnet test
Quick example showing how to exclude tests in a certain project when running dotnet test. The problem I have a solution that contains three different test projects: MyProject.Core.Tests...
View ArticleJOS.ContentSerializer now supports TimeSpan? out of the box
Saw the following post today and decided to update JOS.ContentSerializer to support TimeSpan? properties. The default implementation is really naive: public object Handle(TimeSpan? value, PropertyInfo...
View ArticleDotnet Core ConfigurationProvider for Docker Swarm Secrets
Where I work, we are using Docker Swarm to host our containers. Since we don't like to commit sensitive data to our git repo (API Keys, passwords etc) we are storing that kind of data in something...
View ArticleSwagger - Tips and Tricks - Part 1
Appending API Key header from UI automatically Hi Josef, I am trying to get my swagger to send the x-api-key in its header, but i cant get it to work. Do you maybe know how to connect the swagger...
View ArticleAWS Lambda + Python + PIP Packages = true
Intro I'm in the process of moving all my stuff from Azure to AWS. One of the things I currently run in Azure is a twitter bot that tweets every hour (it even made the local news a couple of years...
View ArticleC# - Sealed and internal - how to use in unit test?
The problem I'm using the Firebase Admin dotnet sdk to send push notifications. They have the following method that allows you to send multiple notifications with one request: public async...
View ArticleSwagger - Tips and Tricks - Part 2
Exclude certain properties from the Swagger UI The problem Sometimes you have some properties on your request model that you don't want to show in the Swagger UI, for whatever reason. The solution I'm...
View ArticleHttpClient - Error handling, a test driven approach
Intro When I wrote my last blog post about HttpClient (You're (probably still) using HttpClient wrong and it is destabilizing your software) I promised to do a post about error handling since I...
View Article