The .NET Stacks #66: 🧀 Who moved my cheese?
Tags: dotnet, csharp, azure
Published: 2021-10-18 11:51:05

---
title: The .NET Stacks #66: 🧀 Who moved my cheese?
published: true
date: 2021-10-18 00:38:34 UTC
tags: dotnet, csharp, azure
canonical_url: https://www.daveabrock.com/2021/10/18/dotnet-stacks-66/
---

I know I'm a day or so late. Sorry, I was reading about Web 3.0 and still don't know what it is. Do you? After [reading this](https://thenewstack.io/web3-architecture-and-how-it-compares-to-traditional-web-apps/), it made me want to cry, laugh, and then cry again. As if Dapr and Dapper isn't enough, now we have "dapps."

Anyway, here's what we have going on this week (or last week):

- Who moved my cheese: New templates for .NET 6 might surprise you
- Community spotlight: Marten v4 is now live
- Last week in the .NET world

* * *

## Who moved my cheese: New templates for .NET 6 might surprise you

As the release of .NET 6 is rapidly approaching—with .NET 6 RC2 coming out _very_ soon with the official release next month—you might be taken aback by C# template changes. The .NET team is leveraging top-level statements and implicit using directives for some new .NET 6 templates. For example, top-level statements are helping to drive new capabilities like [Minimal APIs](https://devblogs.microsoft.com/aspnet/asp-net-core-updates-in-net-6-preview-4/#introducing-minimal-apis). Microsoft has put together a new document, [_New C# templates generate top-level statements_](https://docs.microsoft.com/en-us/dotnet/core/tutorials/top-level-templates), and you should check it out.

With .NET 6, if you create a new console app using `dotnet new console` (or from Visual Studio tooling), you might expect to see this:

```csharp
using System;

namespace MyVerboseApp
{
    public class Program
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
        }
    }
}
```

Think again. You'll see this instead:

```csharp
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
```

Much like with top-level statements, you probably have one of two opinions: it eliminates boilerplate and makes it simpler and more beginner-friendly; or it provides too many abstractions and "I didn't ask for this." I do like top-level statements and agree it eliminates a lot of boilerplate. When it comes to using `args`, though, I like to see where they are being passed in and not just a magic variable.

As of now, to stay consistent with Microsoft pushing to make C# more concise and accessible, it looks like this will be the default template. You can always [use the "old" program style](https://docs.microsoft.com/en-us/dotnet/core/tutorials/top-level-templates#use-the-old-program-style) from the terminal using `framework` and `target-framework-override` flags. This allows you to use the "old" template but force the project framework to be .NET 6.0. (It would have been simpler to pass in `--leave-my-stuff-alone`, but I digress.)

```
dotnet new console --framework net5.0 --target-framework-override net6.0
```

In terms of the tooling experience, the obvious answer will be to eventually introduce a checkbox in Visual Studio to enable/disable these simplified layouts. Until then, you can [downgrade the target framework moniker](https://docs.microsoft.com/en-us/dotnet/core/tutorials/top-level-templates#use-the-old-program-style-in-visual-studio) (TFM) to `net5.0`.

If you don't like it, you can file an issue in the [dotnet/templating repo](https://github.com/dotnet/templating) (or [chime in on a similar issue](https://github.com/dotnet/templating/issues/3654)), or even [create your own templates](https://auth0.com/blog/create-dotnet-project-template/).

* * *

## Community spotlight: Marten v4 is now live

Do you know about Marten? It's a [popular .NET library](https://martendb.io/introduction.html) that allows you to use Postgresql as both a document database and a powerful event store. Jeremy Miller [wrote this week](https://jeremydmiller.com/2021/10/08/marten-takes-a-giant-leap-forward-with-the-official-v4-release/) about the new v4 release. Jeremy got my attention with quoting "the immortal philosopher Ferris Bueller" but also highlighted the massive changes:

- Reducing object allocations and dictionary lookups
- LINQ support improvements
- Better tracking for flexible metadata
- Event sourcing improvements

It looks to be a great release, and congrats to the team and all the great contributors. Check out [the GitHub repository](https://github.com/JasperFx/Marten) for more details about the project.

* * *

## 🌎 Last week in the .NET world

### 

### 📢 Announcements

- Windows 11 [has arrived](https://blogs.windows.com/windowsexperience/2021/10/04/windows-11-a-new-era-for-the-pc-begins-today).
- Mark Weitzel [provides an update on the Azure REST API guidelines](https://garywoodfine.com/how-to-implement-cross-cutting-concerns-with-mediatr-pipeline-behaviours/).
- The Azure SDK team [rolls out new Azure Monitor client libraries](https://devblogs.microsoft.com/azure-sdk/announcing-the-new-azure-monitor-query-client-libraries/).
- Bri Achtman [writes about some ML.NET updates](https://devblogs.microsoft.com/dotnet/ml-net-and-model-builder-october-updates).
- The GitHub Advisory Database [now powers](https://github.blog/2021-10-07-github-advisory-database-now-powers-npm-audit/) `npm audit`.

### 📅 Community and events

- Last week was an eventful week for the .NET Foundation. I'm not going to rehash all the events—you can read [a thread on the issues](https://github.com/dotnet-foundation/Home/discussions/38#discussioncomment-1445759), now former Executive Director Claire Novotny's [apology](https://github.com/dotnet-foundation/Home/discussions/39), the comments surrounding it, and the announcement of a [change in leadership](https://github.com/dotnet-foundation/Home/discussions/40). Let's hope we see _structural_ changes, and don't unfairly scapegoat another invaluable member of the .NET community.
- Myles Borins [announces a new public beta of GitHub Releases](https://github.blog/2021-10-04-beta-github-releases-improving-release-experience/).
- DaprCon is a thing [and is happening next week](https://blog.dapr.io/posts/2021/10/05/join-us-for-daprcon-october-19th-20th-2021/).
- For community standups: .NET MAUI [talks about Hot Reload](https://www.youtube.com/watch?v=cEoSkHZlKa4), EF talks about [SQL Server temporal tables and EF Core 6](https://www.youtube.com/watch?v=2aCgKM41NFw), and ASP.NET [updates us on Orchard Core](https://www.youtube.com/watch?v=1JnshGlNoBg).
- The Netflix Blog writes about how they [safely update client applications](https://netflixtechblog.com/safe-updates-of-client-applications-at-netflix-1d01c71a930c).
- Community releases: Marten v4 [is now live](https://jeremydmiller.com/2021/10/08/marten-takes-a-giant-leap-forward-with-the-official-v4-release/), Blazored Toast v3.2 [is released](https://twitter.com/BlazoredTweets/status/1446547399229550595), and [Cake v1.3.0 is out](https://cakebuild.net/blog/2021/10/cake-v1.3.0-released).
- FluentValidation [has reached 100 million downloads](https://twitter.com/JeremySkinner/status/1446086365767217152).

### 🌎 Web development

- David Walsh [writes about the accent-color CSS property](https://davidwalsh.name/css-accent-color).
- Damien Bowden [implements a secure API and a Blazor app in the same ASP.NET Core project with Azure AD authentication](https://damienbod.com/2021/10/04/implement-a-secure-api-and-a-blazor-app-in-the-same-asp-net-core-project-with-azure-ad-authentication/).
- Litan Sarker [develops a web app with Angular 12, ASP.NET Core Web API, and SQL Server](https://www.c-sharpcorner.com/article/developing-a-web-app-using-angular-12-asp-net-core-web-api-and-sql-server/).
- Mike Brind [writes about the Razor Pages startup experience in .NET 6](https://www.mikesdotnetting.com/article/357/razor-pages-startup-in-net-6).
- Scott Hanselman [writes about Microsoft's guidance on ASP.NET Core diagnostic scenarios](https://www.hanselman.com/blog/aspnet-core-diagnostic-scenarios).
- David Ramel [writes about Azure Functions support for .NET 6](https://visualstudiomagazine.com/articles/2021/10/01/azure-functions-4-preview.aspx).
- Andrew Lock [builds a middleware pipeline with WebApplication](https://andrewlock.net/exploring-dotnet-6-part-4-building-a-middleware-pipeline-with-webapplication/).
- Nwose Lotanna Victor writes about [things developers do](https://www.telerik.com/blogs/things-developers-do-affect-web-app-load-time) to affect web app load time.

### 🥅 The .NET platform

- Matthew Jones [writes about DateOnly and TimeOnly in .NET 6](https://swimburger.net/blog/dynamics/delaying-javascript-execution-until-html-elements-are-present-in-power-apps-and-dynamics-crm).
- Khalid Abuhakmeh [walks through EF Core ConnectionStrings](https://khalidabuhakmeh.com/entity-framework-core-connectionstrings-for-dotnet-apps).
- The Code Maze blog [writes about code coverage in .NET](https://code-maze.com/dotnet-code-coverage/).
- David McCarter [writes about properly disposing of objects in .NET](https://www.c-sharpcorner.com/article/everything-that-every-net-developer-needs-to-know-about-disposable-types-prop/).
- Scott Hanselman [writes about the differences between Hashtable, Dictionary, ConcurrentDictionary, and ImmutableDictionary](https://www.hanselman.com/blog/differences-between-hashtable-vs-dictonary-vs-concurrentdictionary-vs-immutabledictionary).

### ⛅ The cloud

- The Microsoft Cloud Show [talks about Azure App Configuration](https://www.microsoftcloudshow.com/podcast/Episodes/429-Azure-App-Configuration/).
- Niels Swimberghe [collaborates on Power Apps using personal environments, Power Platform CLI, Git, and Azure DevOps](https://swimburger.net/blog/dynamics/collaborating-on-power-apps-using-personal-environments-power-platform-cli-git-and-azure-devops).
- Justin Yoo writes about [different ways to integrate Azure Functions auth with OpenAPI](https://dev.to/azure/6-ways-azure-functions-endpoints-auth-via-openapi-4j0d).

### 📔 Languages

- Elijah Manor [quickly populates a new array in JavaScript](https://elijahmanor.com/byte/js-fill-array).
- Dave Brock [works with file-scoped namespaces in C# 10](https://www.daveabrock.com/2021/10/05/csharp-10-file-scoped-namespaces/).
- Assis Zang [has 6 tips for writing elegant C# code](https://www.telerik.com/blogs/6-tips-writing-elegant-csharp-code).
- Joël Quenneville asks: [who is empowered by your API design](https://thoughtbot.com/blog/who-is-empowered-by-your-design)?

### 🏗 Design, testing, and best practices

- Peter Vogel [uses JustMock to unit test legacy applications](https://www.telerik.com/blogs/unit-testing-legacy-applications-dealing-legacy-code-justmock).
- Steven J. Vaughan-Nichols [writes about the refresh of the OWASP Top 10](https://thenewstack.io/the-latest-owasp-top-10-looks-a-lot-like-the-old-owasp/).
- Dennis Martinez [writes about challenges with automated end-to-end testing](https://www.telerik.com/blogs/top-challenges-automated-end-to-end-testing).
- Sam Scott and Graham Neray [write about best practices for authentication and authorization for REST APIs](https://stackoverflow.blog/2021/10/06/best-practices-for-authentication-and-authorization-for-rest-apis/).
- Davide Bellone [offers a clean code tip](https://www.code4it.dev/cleancodetips/use-same-name-for-same-concept).
- Sarah Drasner [writes about why flow matters more than passion](https://leaddev.com/culture-engagement-motivation/why-flow-matters-more-passion).
- Derek Comartin writes about his [top patterns for event-driven architecture](https://codeopinion.com/my-top-patterns-for-event-driven-architecture/).

### 🎤 Podcasts and videos

- Adventures in .NET [talk about pair programming](https://adventuresindotnet.com/want-to-pair-up-net-089) and also [continues the discussion on advocating for yourself](https://adventuresindotnet.com/advocate-for-yourself-part-2-net-088).
- Jesse Liberty [talks to Mads Torgersen about C# 10](https://jesseliberty.com/2021/10/07/mads-torgersen-on-c-10/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+JesseLiberty-SilverlightGeek+%28Jesse+Liberty%29).
- The .NET Core Show talks to Carl-Hugo Marcotte [about ASP.NET Core 5 design patterns](https://dotnetcore.show/episode-84-asp-net-core-5-design-patterns-with-carl-hugo-marcotte/).
- Visual Studio Toolbox [discusses Solution Filters in Visual Studio](https://channel9.msdn.com/Shows/Visual-Studio-Toolbox/Solution-Filters-in-Visual-Studio).
- On .NET talks about [using DynamicData](https://www.youtube.com/watch?v=yVd7vbeFj-g).