![]() |
|
ASP.NET Core updates in .NET 5 Preview 6 - Printable Version +- Sick Gaming (https://sickgaming.net) +-- Forum: Programming (https://sickgaming.net/forum-76.html) +--- Forum: C#, Visual Basic & .NET (https://sickgaming.net/forum-79.html) +--- Thread: ASP.NET Core updates in .NET 5 Preview 6 (/thread-95938.html) |
ASP.NET Core updates in .NET 5 Preview 6 - xSicKxBot - 06-28-2020 ASP.NET Core updates in .NET 5 Preview 6 Sourabh June 25th, 2020 .NET 5 Preview 6 is now available and is ready for evaluation. Here’s what’s new in this release:
Get started To get started with ASP.NET Core in .NET 5.0 Preview 6 install the .NET 5.0 SDK. You need to use Visual Studio 2019 16.7 or Visual Studio 2019 for Mac 8.6 to use .NET 5.0. Install the latest version of the C# extension, to use .NET 5.0 with Visual Studio Code. Upgrade an existing project To upgrade an existing ASP.NET Core 5.0 Preview 5 app to ASP.NET Core 5.0 Preview 6:
See the full list of breaking changes in ASP.NET Core 5.0. That’s it! You should now be all set to use .NET 5 Preview 6. What’s new? Blazor WebAssembly template now included The Blazor WebAssembly template is now included in the .NET 5 SDK along with the Blazor Server template. To create a Blazor WebAssembly project, simply run Code: dotnet new blazorwasmJSON extension methods for Code: HttpRequestCode: HttpResponseYou can now easily read and write JSON data from an Code: HttpRequestCode: HttpResponseCode: ReadFromJsonAsyncCode: WriteAsJsonAsyncCode: System.Text.JsonCode: HasJsonContentTypeThe JSON extension methods can be combined with endpoint routing to create JSON APIs in a style of programming we call “route to code”. It is a new option for developers who want to create basic JSON APIs in a lightweight way. For example, a web app that has only a handful of endpoints might choose to use route to code rather than the full functionality of ASP.NET Core MVC. Code: endpoints.MapGet("/weather/{city:alpha}", async context =>
{ var city = (string)context.Request.RouteValues["city"]; var weather = GetFromDatabase(city); await context.Response.WriteAsJsonAsync(weather);
});Find out more about the JSON extension methods in a recent On .NET interview about route to code. Extension method to allow anonymous access to an endpoint You can now allow anonymous access to an endpoint using the simpler Code: AllowAnonymousCode: public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{ app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapGet("/", async context => { await context.Response.WriteAsync("Hello World!"); }) .AllowAnonymous(); });
}Custom handling of authorization failures is now easier with the new Code: IAuthorizationMiddlewareResultHandlerCode: IAuthorizationMiddlewareResultHandlerSignalR Hub filters Hub filters, called Hub pipelines in ASP.NET SignalR, is a feature that allows you to run code before and after Hub methods are called, similar to how middleware lets you run code before and after an HTTP request. Common uses include logging, error handling, and argument validation. You can read more about this Hub filters on the docs page. Give feedback We hope you enjoy this release of ASP.NET Core in .NET 5! We are eager to hear about your experiences with this latest .NET 5 release. Let us know what you think by filing issues on GitHub. Thanks for trying out ASP.NET Core! |