The .NET Stacks #66: 🧀 Who moved my cheese?
source link: https://www.daveabrock.com/2021/10/18/dotnet-stacks-66/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
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, 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. Microsoft has put together a new document, New C# templates generate top-level statements, 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:
using System;
namespace MyVerboseApp
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
Think again. You'll see this instead:
// 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 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 (TFM) to net5.0
.
If you don't like it, you can file an issue in the dotnet/templating repo (or chime in on a similar issue), or even create your own templates.
Community spotlight: Marten v4 is now live
Do you know about Marten? It's a popular .NET library that allows you to use Postgresql as both a document database and a powerful event store. Jeremy Miller wrote this week 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 for more details about the project.
🌎 Last week in the .NET world
📢 Announcements
📅 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, now former Executive Director Claire Novotny's apology, the comments surrounding it, and the announcement of a change in leadership. 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.
- DaprCon is a thing and is happening next week.
- For community standups: .NET MAUI talks about Hot Reload, EF talks about SQL Server temporal tables and EF Core 6, and ASP.NET updates us on Orchard Core.
- The Netflix Blog writes about how they safely update client applications.
- Community releases: Marten v4 is now live, Blazored Toast v3.2 is released, and Cake v1.3.0 is out.
- FluentValidation has reached 100 million downloads.
🌎 Web development
🥅 The .NET platform
⛅ The cloud
📔 Languages
🏗 Design, testing, and best practices
🎤 Podcasts and videos
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK