DbExpressionBuilder.CastTo Method (DbExpression, TypeUsage)
Creates a new DbCastExpression that applies a cast operation to a polymorphic argument.
Assembly: EntityFramework (in EntityFramework.dll)
Parameters
- argument
-
Type:
System.Data.Entity.Core.Common.CommandTrees.DbExpression
The argument to which the cast should be applied.
- toType
-
Type:
System.Data.Entity.Core.Metadata.Edm.TypeUsage
Type metadata that specifies the type to cast to.
Return Value
Type: System.Data.Entity.Core.Common.CommandTrees.DbCastExpressionA new DbCastExpression with the specified argument and target type.
Exception | Condition |
---|---|
ArgumentNullException | argument or toType is null. |
ArgumentException | The specified cast is not valid. |