ASP.NET Core - API versioning by convention
2017-05-04
If you were looking for information about API versioning support for ASP.NET Core you’ve probably come across Microsoft.AspNetCore.Mvc.Versioning library. The library itself allows you to set up versioning in a couple of different ways, for instance, via attributes or via manual convention setup. All of this options are really nice but unfortunately, they have one significant drawback, namely, you have to set them up manually. As I tend to forget about this kind of things I wanted to automate that process as much as possible. Thankfully ASP.NET Core has a very nice feature called ApplicationModelConventions which allows you to add some metadata(like routing information, API versioning ) to your controller, actions etc.
651 words
|
3 minutes
ASP.NET Core - default API version with url path versioning
2017-05-03
When you start versioning your API sometimes you want to have access to your endpoints without specifying version explicitly.
Thanks to Microsoft.AspNetCore.Mvc.Versioning library this can be easily achieved with proper setup of configuration action.
However, it turns out that in order to enable default API version for url path versioning, there are a couple additional steps to do.
435 words
|
2 minutes
VS Code - forcing partial IntelliSense support for Cake scripts
2017-04-12
I’ve been using Cake for quite some time now, and I really like this tool, however the more complex my build scripts are, the more painful lack of IntelliSense is.
Inspired a bit by this post, I decided to see what it takes to enable at least partial IntelliSense for Cake scripts in Visual Studio Code.
989 words
|
5 minutes
Downgrading Visual Studio Code extension
2017-04-09
For time to time when you update Visual Studio Code’s extension you realize that there were some breaking changes you don’t like or the extension has a bug which prevents you from using it.
Usually, in this kind of situations, you would like to just go back to the version you were using previously rather than stop using the extension at all.
Unfortunately, VSCode doesn’t give us an option to install a specific version of the extension for now.
Luckily there is an easy way of doing that manually.
239 words
|
1 minute
Asp.NET Core - populating IOptions<T> from external data source
2017-02-26
In ASP.NET Core web.config is no longer a proper place for storing application settings.
New framework introduces the concept of a json based configuration and the default file which stores the settings now is appsettings.json.
Here is a quick tutorial how to use new features.
514 words
|
3 minutes
XUnit - sharing test data across assembly
2017-02-19
XUnit provides two ways of sharing data between tests - ICollectionFixture and IClassFixture.
The first one allows you to shared context across collections and the second one across test classes.
I’ve already had a couple of cases in which these fixtures were not enough.
Basically, I wanted to share data between all tests in given assembly - without worrying in which test class or test collection given test is.
In these circumstances, I’ve usually used some kind of old fashioned singleton or custom TestFrameworkExecutor.
I’ve never liked those solutions, fortunately recently I’ve come across a nice little library - xunit.assemblyfixture.
354 words
|
2 minutes
ASP.NET Core - tracking flow of requests with NLog
2017-02-18
A while ago I wrote an article about using MappedDiagnosticsLogicalContext for tracking request flow in your application.
As we are moving our project to ASP.NET Core, I wanted to keep that functionality in place.
Unfortunately, MDLC layout renderer is not available in that framework anymore(when targeting .NET Core).
Luckily, there are two other renderers which can be used as a replacement:
1076 words
|
5 minutes
Boxstarter - breaking infinite reboot loop
2016-12-19
Boxstarter is a great tool for configuring your machine without any user interaction.
I’ve been using it for a while now, however recently I’ve noticed that for no apparent reason it wasn’t able to finish the execution of provisioning script as it stuck in infinite reboot loop.
Is was quite frustrating for me, that is why I’ve decided to investigate the problem. Here are my findings.
398 words
|
2 minutes