This article is a detailed introduction of the. NET Core 2.0 PREVIEW2 Release summary of relevant content, with a certain reference value, interested in small partners can refer to
Objective
See my blog about the new features of ASP. NET Core 2.0. This article is some of the improvements in PRIVIEW2.
. NET Core 2.0-preview2
Improvements to Azure
The Docker image is transferred to the Debian Stretch
Repair and support for MacOS high Sierra
Improvements in quality and performance
dotnet Restore will be implicitly called when Dotnet Run,publish,build
The. NET Standard library can reference the. NET Framework Library
The. NET Standard NuGet Package Nuspec no longer needs to be added for netstandard.library dependencies
ASP. NET Core 2.0-preview2
Updated templates for Visual Studio and more templates for spa projects. Including (Angular, React.js, React.js and Redux) and so on.
Added a template for creating a new ASP. NET Core Project in Visual Studio 2017.
Kestrel has added some configuration options, including (Maxconcurrentconnections,maxrequestbodysize,requestbodyminimumdatarate), and so on.
Razor supports C # 7.1. This configuration can be specified in csproj <langversion>latest</langversion> is turned on.
Added support for Filestreamresult,filecontentresult HTTP headers in MVC action. Now you can add ETag, lastupdate and so on.
Two new Filters (Ipagefilter,iasyncpagefilter) for Razor page have been added.
About the Identity-related services in Priview 1 There are also configuration https cut off, they also need time to polish, waiting for later release.
Entity Framework Core 2.0-preview2
New NuGet Packages and kits (Microsoft.EntityFrameworkCore.Tools.DotNet)
The 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:
@p0 = ' London ' (size = 4000) @p1 = ' Sales representative ' (size = 4000) SELECT *from customerswhere city = @p0 and ContactTitle = @p1
Entity type Auto-split table (functions in Priview1), only one table will be created below.
Modelbuilder.entity<order> (). Ownsone (p = p.orderdetails, CB = CB. Ownsone (c = c.billingaddress); Cb. Ownsone (c = c.shippingaddress); });p Ublic 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 your code, and note that the return value can only be 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, and 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, outdated APIs, etc.)