The C# 9 init-only setters

In a previous post in which we discussed about the Null Object Pattern, we discussed of a hackish approach to make sure that the default properties cannot be changed. Please note that the code snippets from this post have been run in LinqPad so they can be used as is, to run them in Visual … Continue reading The C# 9 init-only setters

Download file via ajax

Hello and welcome 😀, In a previous post we discussed how to create a zip file on demand on the server so that it can be served via Web API. The code for the previous post and this one for can be found in my github repository. So today we're going to look at how … Continue reading Download file via ajax

Mocking LINQ Expressions

Hello and welcome In today's post, we will discuss mocking/stubbing lambda expressions so that we can have a bit more control over our unit tests. Keep in mind that I'm by no means versed in expression trees so I will try my best to explain. What is an Expression and how to use it Going … Continue reading Mocking LINQ Expressions

The rise of the Null-Object pattern in C# 8

Hello and welcome, As I probably mentioned in some of my older posts, I'm a big fan of code restrictions that can be imposed by the IDE. I think this is a reason why stylecop was/is so popular (I don't know since I mostly use Rider nowadays and Resharper for Visual Studio). Because of this, … Continue reading The rise of the Null-Object pattern in C# 8

Typed claims in ASP.Net Core 2.1

Hello and Welcome 🙂 Today I want to discuss about how we can use claims following a typed approach, this topic came about from a bug that was encountered during a code review for an application. As such I wanted to find a way of mitigating such issues in the future by using concrete classes … Continue reading Typed claims in ASP.Net Core 2.1

Application triggers for Asp.Net Core 2.1 entity framework core

Hello and welcome 🙂 Today I wanted to talk about extending your application and your DbContext to run arbitrary code when a save occurs. The backstory While working with quite a few applications that work with databases especially using entity framework, I noticed the pattern of saving changes to the database and then do something … Continue reading Application triggers for Asp.Net Core 2.1 entity framework core