Share via


DbExpressionBuilder.TreatAs(DbExpression, TypeUsage) Method

Definition

Creates a new 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

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.

Applies to