What's New in ASP.NET Core 3 Preview 6
ASP.NET Core 3 seems to be taking a similar tact to version 1 as it is adding a lot of functionality and phasing it in with different previews. While a lot of the articles seem to be focusing on the non-ASP.NET features (e.g. WPF, WinForms, etc.), I thought it would be nice to let those of you who are ASP.NET devs know what is in Preview 6 just for you.
It feels a lot like the ASP.NET MVC/API side is being treated as mature and stable as there is are not a lot of surface changes. Microsoft does seem to be doubling down on Razor Pages and Blazor. It feels like they want .NET Core to be a good fit for different styles and backgrounds of developer. This release is no different.
Let’s take a look at the details:
- @attribute: Let’s you add attributes usage in your Razor files (more common in .razor components than in .cshtml files)
- @code: Equivalent to @functions feature. Only supported in .razor file components. Used to add code blocks.
- @key: Used to help Blazor optimize handling lists of components so that it knows a key to know what to replace or where to insert new objects in a Blazor view.
- Blazor attributes have been standardized to a format of @directive(-suffix(:name))(=value)
- Blazor templates now support Authentication and Authorization
Preview 6 now supports Certificate and Kerberos authentiation and authorization. For example:
services.AddAuthentication( CertificateAuthenticationDefaults.AuthenticationScheme) .AddCertificate();
This opens ASP.NET Core to more security requirements. I’m excited to see this.
By opting into the new client-side @aspnet/signalr@next you’ll be able to add auto reconnection via opting into it in your SignalR projects:
const connection = new signalR.HubConnectionBuilder() .withUrl("/chatHub") .withAutomaticReconnect() .build();
This will reconnect at 2, 10 and 30 second intervals. You can customize these timings too.
gRPC now has a completely managed client. So if you’re building .NET end-to-end via a gRPC endpoint, you can now do this much easier with both a managed client and a client factory. I see gRPC as a good replacement for WCF’s non-http services. If you haven’t looked at gRPC yet, it’s an interesting technology if you’re not expecting a variety of clients. SignalR is built via gRPC under the covers. And yes, gRPC is an open spec, not a Microsoft invention. See an overview at https://grpc.io/docs/guides/.