Best .NET Posts This Week: 31st January 2021

Best .NET Posts This Week: 31st January 2021

Here are some of the best .NET, C# and ASP NET posts from this week.

This Weeks Articles

.NET 5 Source Generators Jump Start

By Khalid Abuhakmeh

You may have heard about a new feature in .NET 5 called Source Generators. Developers can now generate dynamic code at compile time that .NET will weave into a consuming assembly. The possibilities are endless and will most likely have a profound impact on how we write applications and, ultimately, the performance we can expect from our apps. That said, getting started with source generators can seem a bit opaque. In this post, we’ll start with nothing and go through creating a source generator ready solution.

How to Create Your .NET Project Template

By Andrea Chiarelli

.NET comes with several project templates that help to quickly scaffold applications in different contexts. You may need to create your own project template in specific contexts. The article explains how you can create your own project template to use with .NET CLI and Visual Studio.

Self-hosted integration tests in ASP.NET

By Mark Seemann

In 2020 I developed a sizeable code base for an online restaurant REST API. In the spirit of outside-in TDD, I found it best to test the HTTP behaviour of the API by actually interacting with it via HTTP. Sometimes ASP.NET offers more than one way to achieve the same end result. For example, to return 200 OK, you can use both OkObjectResult and ObjectResult. I don't want my tests to be coupled to such implementation details, so by testing an API via HTTP instead of using the ASP.NET object model, I decouple the two. You can easily self-host an ASP.NET web API and test it using an HttpClient. In this article, I'll show you how I went about it.

You Might Also Like

"Ten++ Ways to Make Money as a Developer" eBook

I post mostly about full stack .NET and Vue web development. To make sure that you don't miss out on any posts, please follow this blog and subscribe to my newsletter. If you found this post helpful, please like it and share it. You can also find me on Twitter.

Did you find this article valuable?

Support Sam Walpole by becoming a sponsor. Any amount is appreciated!