This article mainly introduces the relevant content of .NET Core 2.0 Preview2 release summary in detail, which has certain reference value. Interested friends can refer to it
Preface
About the new features of ASP.NET Core 2.0, you can check out this blog of mine. This article is about some improvements in Priview2.
.NET Core 2.0 - Preview2
Azure improvements
Docker images moved to Debian Stretch
Fixes and support for macOS High Sierra
Quality and Performance improvement
dotnet restore will be called implicitly during dotnet run, publish, build
.NET Standard library can reference .NET Framework library
.NET Standard NuGet package nuspec no longer needs to add dependencies for NETStandard.Library
ASP.NET Core 2.0 - Preview2
Updated the Visual Studio templates and added templates for SPA projects. Including (Angular, React.js, React.js and Redux), etc.
#Added a template for creating a new ASP.NET Core project in Visual Studio 2017 using the .NET Framework framework.
Kestrel adds some configuration options, including (MaxConcurrentConnections, MaxRequestBodySize, RequestBodyMinimumDataRate), etc.
Razor supports C# 7.1. This configuration can be enabled by specifying
For FileStreamResult in MVC Action, the Http header of FileContentResult increases the supported range. ETag, LastUpdate, etc. can now be added.
Added two new filters (IPageFilter, IAsyncPageFilter) about Razor Page.
Regarding the Identity related services in Priview 1 and the configuration of HTTPS, they have been cut off. They still need time to polish and wait for future release.
Entity Framework Core 2.0 - Preview2
New NuGet packages and toolkits (Microsoft.EntityFrameworkCore.Tools.DotNet)
##FromSql and ExecuteSqlCommand #StringInterpolation, 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(); }
@p0='London' (Size = 4000) @p1='Sales Representative' (Size = 4000) SELECT * FROM Customers WHERE City = @p0 AND ContactTitle = @p1
modelBuilder.Entity<Order>().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; } }
public class BloggingContext : DbContext { [DbFunction] // 添加这个标记,静态方法 public static int PostReadCount(int blogId) { throw new Exception(); } }
var query = from p in context.Posts where BloggingContext.PostReadCount(p.Id) > 5 select p;
The above is the detailed content of Detailed introduction to .NET Core 2.0 Preview2. For more information, please follow other related articles on the PHP Chinese website!