Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the improvements in the .NET Core 2.0 Preview 2 release?

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

In this issue, the editor will bring you the release of .NET Core 2.0 Preview2. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

.net Core 2.0-Preview2

Improvement of Azure

Docker image transferred to Debian Stretch

Fix and support macOS High Sierra

Improvement in quality and performance

Dotnet restore will be implicitly called during dotnet run,publish,build

The .NET Standard library can reference the .NET Framework library.

The .NET Standard NuGet package nuspec no longer needs to add a dependency on NETStandard.Library

ASP.NET Core 2.0-Preview2

Updated the template of Visual Studio and added the template of SPA project. Including (Angular, React.js, React.js and Redux) and so on.

Added a template that uses the .NET Framework Framework for a new ASP.NET Core project in Visual Studio 2017.

Kestrel adds a number of configuration options, including (MaxConcurrentConnections,MaxRequestBodySize,RequestBodyMinimumDataRate) and so on.

Razor supports C # 7.1. This configuration can be enabled by specifying latest in csproj.

Increased support for Http headers for FileStreamResult,FileContentResult in MVC Action. Now you can add ETag, LastUpdate, and so on.

Two new filters for Razor Page (IPageFilter,IAsyncPageFilter) have been added.

The Identity-related services in Priview 1 and the configuration HTTPS have been cut off, and they still need time to polish and wait for a later release.

Entity Framework Core 2.0-Preview2

New NuGet package and toolkit (Microsoft.EntityFrameworkCore.Tools.DotNet)

String interpolation in FromSql and ExecuteSqlCommand, and the SQL they generate will be automatically parameterized.

Var city = "London"; var contactTitle = "Sales Representative"; using (var context = CreateContext ()) {context.Customers .FromSql ($@ "SELECT * FROM Customers WHERE City = {city} AND ContactTitle = {contactTitle}") .ToArray ();}

Generated SQL:

@ p0roomLondon` (Size = 4000) @ p1='Sales Representative' (Size = 4000) SELECT * FROM CustomersWHERE City = @ p0 AND ContactTitle = @ p1

The entity type automatically splits the table (improving the functionality in Priview1), and only one table will be created below.

ModelBuilder.Entity () .OwnsOne (p = > p.OrderDetails, cb = > {cb.OwnsOne (c = > c.BillingAddress); cb.OwnsOne (c = > c.ShippingAddress);}); public class Order {public int Id {get; set;} public OrderDetails OrderDetails {get; set;} public class OrderDetails {public Address BillingAddress {get; set;} public Address ShippingAddress {get; set;} public class Address {public string Street {get; set;} public string City {get; set;}

Database function mapping, you can use the functions defined in the database in the code, note that the return value can only be a single (scalar).

Public class BloggingContext: DbContext {[DbFunction] / / add this tag, static method public static int PostReadCount (int blogId) {throw new Exception ();}}

The PostReadCount function defined in the database will be called. The function must be created manually, and EF will not be generated automatically.

Var query = from p in context.Posts where BloggingContext.PostReadCount (p.Id) > 5 select p

Other improvements (compatibility, obsolete api, etc.)

The above is the .NET Core 2.0 Preview2 that the editor shared with you. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report