DbExpressionBuilder.CastTo(DbExpression, TypeUsage) Method

Definition

Creates a new DbCastExpression that applies a cast operation to a polymorphic argument.

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

Parameters

argument
DbExpression

The argument to which the cast should be applied.

toType
TypeUsage

Type metadata that specifies the type to cast to.

Returns

A new DbCastExpression with the specified argument and target type.

Exceptions

Argument or toType is null.

The specified cast is not valid.

Applies to