. NET Core 2.0 Preview2 release summary, corepreview2

Source: Internet
Author: User

. NET Core 2.0 Preview2 release summary, corepreview2

Preface

For more information about ASP. NET Core 2.0, see my blog. This article provides some improvements in priview2.

. NET Core 2.0-Preview2

Azure improvements
Docker image transferred to Debian Stretch
Fix and support macOS High siider
Quality and performance improvement
Dotnet restoreIt will be called implicitly during dotnet run, publish, and build
The. NET Standard library can reference the. NET Framework library.
. NET Standard NuGet package nuspec no longer needs to be addedNETStandard. LibraryDependency

ASP. NET Core 2.0-Preview2

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


Added a template for creating an ASP. NET Core project using the. NET Framework in Visual Studio 2017.


Kestrel adds some configuration options, including (MaxConcurrentConnections, MaxRequestBodySize, RequestBodyMinimumDataRate.

Razor supports C #7.1. This configuration can be specified in csproj<LangVersion> latest </LangVersion>Enable.
For FileStreamResult in MVC Action, the Http header of FileContentResult adds the supported range. Now you can add ETag and LastUpdate.

Two filters (IPageFilter, IAsyncPageFilter) about Razor Page are added ).
For the Identity-related services in Priview 1, HTTPS configuration has been cut off. They still need time to polish and wait for release.

Entity Framework Core 2.0-Preview2

New NuGet package and toolkit (Microsoft. EntityFrameworkCore. Tools. DotNet)
String interpolation in FromSql and ExecuteSqlCommand. The generated SQL statements are 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

The object type is automatically split into tables (Improving the function 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); });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 ing. 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 flag. The static method is public static int PostReadCount (int blogId) {throw new Exception ();}}

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

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

Other improvements (compatibility, outdated APIs, etc)

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.