Redigera

Dela via


DbExpressionBuilder.TreatAs(DbExpression, TypeUsage) Method

Definition

Creates a new DbTreatExpression.

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

Parameters

argument
DbExpression

An expression that specifies the instance.

treatType
TypeUsage

Type metadata for the treat-as type.

Returns

A new DbTreatExpression with the specified argument and type.

Exceptions

argument or treatType is null.

treatType is not in the same type hierarchy as the result type of argument.

Remarks

DbTreatExpression requires that argument has a polymorphic result type, and that treatType is a type from the same type hierarchy as that result type.

Applies to