News

What's New for ASP.NET Core and Blazor in Production-Ready .NET Core 3.0 Preview 7

With .NET Core 3.0 becoming production-ready and transitioning from new features to a focus on stability and reliability in Preview 7, Microsoft has detailed a slew of new features for the ASP.NET and Blazor components.

Microsoft's Daniel Roth summarized the new features thusly:

  • Latest Visual Studio preview includes .NET Core 3.0 as the default runtime: "The latest preview update for Visual Studio (16.3) includes .NET Core 3.0 as the default .NET Core runtime version. This means that if you install the latest preview of Visual Studio then you already have .NET Core 3.0. New project by default will target .NET Core 3.0."

  • Top level ASP.NET Core templates in Visual Studio: "The ASP.NET Core templates now show up as top level templates in Visual Studio in the 'Create a new project' dialog."

  • Simplified Web templates: "We've taken some steps to further simplify the Web app templates to reduce the amount of code that is frequently just removed. Specifically:
    • The cookie consent UI is no longer included in the web app templates by default.
    • Scripts and related static assets are now referenced as local files instead of using CDNs based on the current environment."

  • Attribute splatting for components: "Components can now capture and render additional attributes in addition to the component's declared parameters. Additional attributes can be captured in a dictionary and then 'splatted' onto an element as part of the component's rendering using the new @attributes Razor directive. This feature is especially valuable when defining a component that produces a markup element that supports a variety of customizations."

  • Data binding support for TypeConverters and generics: "Blazor now supports data binding to types that have a string TypeConverter. Many built-in framework types, like Guid and TimeSpan have a string TypeConverter, or you can define custom types with a string TypeConverter yourself. These types now work seamlessly with data binding."

  • Clarified which directive attributes expect HTML vs C#: "In Preview 6 we introduced directive attributes as a common syntax for Razor compiler related features like specifying event handlers (@onclick) and data binding (@bind). In this update we've cleaned up which of the built-in directive attributes expect C# and HTML. Specifically, event handlers now expect C# values so a leading @ character is no longer required when specifying the event handler value."

  • EventCounters: "In place of Windows perf counters, .NET Core introduced a new way of emitting metrics via EventCounters. In preview7, we now emit EventCounters ASP.NET Core. You can use the dotnet counters global tool to view the metrics we emit."

  • HTTPS in gRPC templates: "The gRPC templates have been now been updated to use HTTPS by default. At development time, we continue the same certificate generated by the dotnet dev-certs tool and during production, you will still need to supply your own certificate."

  • gRPC client improvements: "The gRPC templates have been now been updated to use HTTPS by default. At development time, we continue the same certificate generated by the dotnet dev-certs tool and during production, you will still need to supply your own certificate."

  • gRPC metapackage: "In 3.0.0-preview7, we've introduced a new package Grpc.AspNetCore that transitively references all other runtime and tooling dependencies required for building gRPC projects. Reasoning about a single package version for the metapackage should make it easier for developers to deal with as opposed multiple dependencies that version independently."

  • CLI tool for managing gRPC code generation: "The new dotnet-grpc global tool makes it easier to manage protobuf files and their code generation settings. The global tool manages adding and removing protobuf files as well adding the required package references required to build and run gRPC applications."

In addition to providing code samples and more details for all of the above, Roth also detailed a new package ID for SignalR's JavaScript client in NPM and new customizable SignalR hub method authorization.

More details are provided in the .NET Core 3.0 release notes.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus

Featured

Subscribe on YouTube