Freigeben über


DbExpressionBuilder.CastTo-Methode

[Diese Seite bezieht sich auf Entity Framework Version 6. Die neueste Version ist als 'Entity Framework' NuGet-Paket verfügbar. Weitere Informationen zu Entity Framework finden Sie unter msdn.com/data/ef.]

Erstellt ein neues DbCastExpression, das einen Umwandlungsvorgang auf ein polymorphes Argument anwendet.

Namespace:  System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder
Assembly:  EntityFramework (in EntityFramework.dll)

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function CastTo ( _
    argument As DbExpression, _
    toType As TypeUsage _
) As DbCastExpression
'Usage
Dim argument As DbExpression 
Dim toType As TypeUsage 
Dim returnValue As DbCastExpression 

returnValue = argument.CastTo(toType)
public static DbCastExpression CastTo(
    this DbExpression argument,
    TypeUsage toType
)
[ExtensionAttribute]
public:
static DbCastExpression^ CastTo(
    DbExpression^ argument, 
    TypeUsage^ toType
)
static member CastTo : 
        argument:DbExpression * 
        toType:TypeUsage -> DbCastExpression
public static function CastTo(
    argument : DbExpression, 
    toType : TypeUsage
) : DbCastExpression

Parameter

Rückgabewert

Typ: System.Data.Entity.Core.Common.CommandTrees.DbCastExpression
Ein neues DbCastExpression mit dem angegebenen Argument und dem Zieltyp.

Hinweis zur Verwendung

In Visual Basic und C# können Sie diese Methode als Instanzenmethode für ein beliebiges Objekt vom Typ DbExpression aufrufen. Bei Verwendung der Syntax für Instanzenmethoden lassen Sie den ersten Parameter aus. Weitere Informationen finden Sie unter https://msdn.microsoft.com/de-de/library/bb384936(v=vs.113) oder https://msdn.microsoft.com/de-de/library/bb383977(v=vs.113).

Ausnahmen

Ausnahme Bedingung
ArgumentNullException

argument oder toType ist null.

ArgumentException

Die angegebene Umwandlung ist ungültig.

Siehe auch

Verweis

DbExpressionBuilder Klasse

System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder-Namespace