Announcing ConfigR 1.0

Recently we released version 1.0 of ConfigR – a popular .NET configuration library, that lets you configure your application via C# scripts (CSX).

This is also the last release requiring full .NET 4.5/Mono – the next version of ConfigR is going to be a netstandard.

Here’s a overview of the features that are there in 1.0!

Continue Reading


Lazy async initialization for expiring objects

Today I wanted to share something I found myself using quite a lot recently, and that is not supported out of the box by the .NET framework.

So, as part of the framework, we have Lazy<T>, which provides out of the box support for deferring the creation of a large or resource-intensive objects.

However, what if the object requires async operation to be created, and what if its value expires after some time, and it needs to be recomputed? Let’s have a look at how to solve this.

Continue Reading


Introducing C# script runner for .NET Core and .NET CLI

In this post I wanted to share a little project I’ve been working on recently – a .NET CLI and .NET Core based script runner for C# (CSX scripts).

The idea was super simple – I just wanted to be able to author C# scripts using .NET Core, leverage project.json to define the script dependencies and execute scripts cross platfom using .NET CLI – via a dotnet script command.

The project is located here on Github. You can head over and have a look at readme to get started – but, briefly, the key features are listed here.

Continue Reading


Strongly typed configuration in ASP.NET Core without IOptions<T>

There are several great resources on the Internet about using the new Configuration and Options framework of ASP.NET Core – like this comprehensive post by Rick Strahl.

Using strongly typed configuration is without a question a great convenience and productivity boost for the developers; but what I wanted to show you today is how to bind IConfiguration directly to your POCO object – so that you can inject it directly into the dependent classes without wrapping into IOptions.

Continue Reading



[Controller] and [NonController] attributes in ASP.NET Core MVC

One of the late additions before the RTM release of ASP.NET Core MVC was the introduction of the [Controller] attribute, and its counterpart, [NonController], which were added in RC2.

Together, they allow you to more specifically control which classes should be considered by the framework to be controllers (or controller candidates) and which shouldn’t. They also help you avoid the nasty hacks we needed to do in i.e. ASP.NET Web API to opt out from the “Controller” suffix in the name.

Let’s have a look.

Continue Reading


Building Analyzers & Refactoring Tools with Roslyn (from NDC Sydney)

Last month I was at the excellent NDC Sydney conference, where I did a talk about building code analyzers and refactoring tools with Roslyn. Below you can find the the video, code and slides from the session.

Thanks to everyone who attended – I had great fun, and I was even mugged by a kangaroo afterwards.

Video

You can watch the talk on Vimeo. And if you are wondering, yes, my t-shirt says “#ENDREGIONS”.

Slides

Just go to this URL. Slides are powered by the almighty FsReveal – they are HTML that was generated from Markdown, because you know, it’s 2016, so we must have build scripts for our slides these days :)

Code

All the demo code is hosted at Github.


Building a lightweight, controller-less, Markdown-only website in ASP.NET Core

In this blog post let’s have a look at building a lightweight site in ASP.NET Core.

In “classic” ASP.NET we had the WebPages framework – which allowed us to build sites composed only of views. This was perfect for lightweight projects, where we didn’t need the entire model-controller infrastructure.

At the moment, ASP.NET Core doesn’t have an equivalent yet (though it’s being worked on), but we have already provided a similar type of experience via the WebApiContrib project (you can read more about the project here). With the help of some of the libraries from there, we can build controller-less sites for ASP.NET Core already.

In addition to that, we can combine it with using Markdown tag helpers for content delivery – and it will result in a very cool experience – being able to author ASP.NET Core sites, without controllers, in Markdown. With Razor sprinkled on top of it, to provide dynamic data.

Let’s have a look – more after the jump.

Continue Reading


Announcing WebApiContrib for ASP.NET Core

In the past, a bunch of us from the ASP.NET Web API community worked together on a WebApiContrib project (or really, projects, cause there were many of them!).

The idea was to provide an easy to use platform, a one stop place for community contributions for ASP.NET Web API – both larger add ons, such as HTML/Razor support for Web API, as well as smaller things like i.e. reusable filters or even helper methods. This worked extremely well – WebApiContrib packages were downloaded over 500k times on Nuget, and a nice community has emerged around the project on Github.

Recently, we decided to restart the project, this time focusing on ASP.NET Core. Since the “brand” has caught on in the community and is fairly recognizable, we just called it WebApiContrib.Core.

Continue Reading


Customizing FormatFilter behavior in ASP.NET Core MVC 1.0

When you are building HTTP APIs with ASP.NET Core MVC, the framework allows you to use FormatFilter to let the calling client override any content negotiation that might have happened on the server side.

This way, the client can – for example – force the return data to be JSON or CSV or any other format suitable (as long as the server supports it, of course) for his consumption.

The built-in mechanism (out of the box version of FormatFilter) is a little limited, so let’s have a look at how you can extend and customize its behavior.

Continue Reading


Pages:123...17»