語言

DbExpressionBuilder.TreatAs(DbExpression, TypeUsage) 方法

定義

會產生一個新的 DbTreatExpression。

public static System.Data.Entity.Core.Common.CommandTrees.DbTreatExpression TreatAs(this System.Data.Entity.Core.Common.CommandTrees.DbExpression argument, System.Data.Entity.Core.Metadata.Edm.TypeUsage treatType);
static member TreatAs : System.Data.Entity.Core.Common.CommandTrees.DbExpression * System.Data.Entity.Core.Metadata.Edm.TypeUsage -> System.Data.Entity.Core.Common.CommandTrees.DbTreatExpression
<Extension()>
Public Function TreatAs (argument As DbExpression, treatType As TypeUsage) As DbTreatExpression

參數

argument
DbExpression

一個用來指定實例的表達式。

treatType
TypeUsage

treat-as 型別的型別元資料。

傳回

一個新的 DbTreatExpression,並帶有指定的參數與型態。

例外狀況

參數或 treatType 為 null。

treatType 與參數的結果類型不在同一類型階層中。

適用於