欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

.NET Core 2.0 Preview2 發(fā)布匯總

 更新時(shí)間:2017年06月29日 14:09:29   作者:Savorboard  
這篇文章主要為大家詳細(xì)介紹了.NET Core 2.0 Preview2 發(fā)布匯總的相關(guān)內(nèi)容,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

前言

關(guān)于 ASP.NET Core 2.0 的新功能可以查看我的這篇博客。 這篇文章是 Priview2中的一些改進(jìn)。

.NET Core 2.0 - Preview2

Azure 的改進(jìn)
Docker 鏡像轉(zhuǎn)移到了 Debian Stretch
修復(fù)并支持 macOS High Sierra
質(zhì)量性能的改進(jìn)
dotnet restore 將在 dotnet run,publish,build 的時(shí)候被隱式調(diào)用
.NET Standard 庫(kù)可以引用 .NET Framework庫(kù)了
.NET Standard NuGet 包 nuspec 不再需要添加對(duì)于NETStandard.Library依賴關(guān)系了

ASP.NET Core 2.0 - Preview2

更新了 Visual Studio 的模板,多了SPA項(xiàng)目的模板。 包括(Angular, React.js, React.js and Redux)等。


添加了在 Visual Studio 2017 中新建 ASP.NET Core 項(xiàng)目使用 .NET Framework框架的模板。


Kestrel 添加了一些配置選項(xiàng),包括(MaxConcurrentConnections,MaxRequestBodySize,RequestBodyMinimumDataRate)等。

Razor 支持 C# 7.1。 此項(xiàng)配置可以在csproj中指定<LangVersion>latest</ LangVersion>開啟。
對(duì)于MVC Action中FileStreamResult,F(xiàn)ileContentResult 的Http頭增加了支持的范圍。 現(xiàn)在可以添加 ETag, LastUpdate等。

新增了兩個(gè)關(guān)于Razor Page的過濾器(IPageFilter,IAsyncPageFilter)。
關(guān)于 Priview 1中的 Identity 相關(guān)的服務(wù)還有配置HTTPS的被割掉了,他們還需要時(shí)間進(jìn)行打磨,等待以后發(fā)布。

Entity Framework Core 2.0 - Preview2

新的 NuGet 包以及工具包(Microsoft.EntityFrameworkCore.Tools.DotNet)
FromSql和ExecuteSqlCommand中的字符串插值,他們生成的SQL將會(huì)自動(dòng)參數(shù)化。

var city = "London";
var contactTitle = "Sales Representative";

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

生成的SQL:

@p0='London' (Size = 4000)
@p1='Sales Representative' (Size = 4000)

SELECT *
FROM Customers
WHERE City = @p0
 AND ContactTitle = @p1

實(shí)體類型自動(dòng)分割表(完善Priview1中的功能),下面將只會(huì)創(chuàng)建一個(gè)表。

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; }
}

數(shù)據(jù)庫(kù)函數(shù)映射,你可以在代碼中使用數(shù)據(jù)庫(kù)中定義的函數(shù)了,注意返回值只能是單個(gè)的(scalar)。

public class BloggingContext : DbContext
{
 [DbFunction] // 添加這個(gè)標(biāo)記,靜態(tài)方法
 public static int PostReadCount(int blogId)
 {
 throw new Exception();
 }
}

將會(huì)調(diào)用數(shù)據(jù)庫(kù)中定義的PostReadCount函數(shù),函數(shù)必須自己手動(dòng)創(chuàng)建,EF不會(huì)自動(dòng)生成。

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

其他的改進(jìn)(兼容性,過時(shí)api等)

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論