Freigeben über


DbExpressionBuilder.Constant-Methode (TypeUsage, Object)

[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 DbConstantExpression vom angegebenen primitiven Typ mit dem angegebenen konstanten Wert.

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

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function Constant ( _
    constantType As TypeUsage, _
    value As Object _
) As DbConstantExpression
'Usage
Dim constantType As TypeUsage 
Dim value As Object 
Dim returnValue As DbConstantExpression 

returnValue = constantType.Constant(value)
public static DbConstantExpression Constant(
    this TypeUsage constantType,
    Object value
)
[ExtensionAttribute]
public:
static DbConstantExpression^ Constant(
    TypeUsage^ constantType, 
    Object^ value
)
static member Constant : 
        constantType:TypeUsage * 
        value:Object -> DbConstantExpression
public static function Constant(
    constantType : TypeUsage, 
    value : Object
) : DbConstantExpression

Parameter

Rückgabewert

Typ: System.Data.Entity.Core.Common.CommandTrees.DbConstantExpression
Ein neuer DbConstantExpression mit dem angegebenen Wert und einem Ergebnistyp von constantType.

Hinweis zur Verwendung

In Visual Basic und C# können Sie diese Methode als Instanzenmethode für ein beliebiges Objekt vom Typ TypeUsage 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

valueconstantType

ArgumentException

value ist keine Instanz eines gültigen konstanten Typs, constantType stellt keinen primitiven Typ dar, oder value hat einen anderen primitiven Typ als den durch constantType dargestellten.

Siehe auch

Verweis

DbExpressionBuilder Klasse

Constant-Überladung

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