Monthly Archives: May 2018

Dependency injection into actions in ASP.NET Core MVC 2.1

A few years ago I blogged about dependency injection directly into actions in ASP.NET Web API. The idea is quite simple – instead of injecting all of your dependencies via the controller’s constructor, you can inject them as parameters into the action handling a given HTTP request.

This can help you prevent over-injection in the constructor; I also like this approach because it’s very verbose and clear – an action explicitly manifests what it needs to handle the request and gets just that, nothing more.

It actually works out of the box in ASP.NET Core, so let’s have a look at that and some related configuration.

Continue Reading

dotnet-script – now on .NET Core 2.1 runtime, with C# 7.3 support and more!

In the previous post, I announced that dotnet-script is now built as global tool and can be installed using .NET Core 2.1 preview SDK. However, by that time it was still based on .NET Core 2.0 runtime (it was possible to build and install .NET Core 2.0 tools using .NET Core 2.1 preview SDK).

Now we have even more cool news to announce – because dotnet-script is now a true .NET Core 2.1 application, and can be used to run scripts on top of .NET Core 2.1 runtime. We release quite often so let me do a quick rundown of all the new features since my last blog post.

Continue Reading