DbExpressionBuilder.Constant Method
Creates a new DbConstantExpression of the specified primitive type with the given constant value.
Assembly: EntityFramework (in EntityFramework.dll)
Name | Description | |
---|---|---|
![]() ![]() | Constant(Object) | Creates a new DbConstantExpression with the given constant value. |
![]() ![]() | Constant(TypeUsage, Object) | Creates a new DbConstantExpression of the specified primitive type with the given constant value. |
DbExpressionBuilder.Constant Method (Object)
Creates a new DbConstantExpression with the given constant value.
Parameters
- value
-
Type:
System.Object
The constant value to represent.
Return Value
Type: System.Data.Entity.Core.Common.CommandTrees.DbConstantExpressionA new DbConstantExpression with the given value.
Exception | Condition |
---|---|
ArgumentNullException | value is null. |
ArgumentException | value is not an instance of a valid constant type. |
DbExpressionBuilder.Constant Method (TypeUsage, Object)
Creates a new DbConstantExpression of the specified primitive type with the given constant value.
Parameters
- constantType
-
Type:
System.Data.Entity.Core.Metadata.Edm.TypeUsage
The type of the constant value.
- value
-
Type:
System.Object
The constant value to represent.
Return Value
Type: System.Data.Entity.Core.Common.CommandTrees.DbConstantExpressionA new DbConstantExpression with the given value and a result type of constantType.
Exception | Condition |
---|---|
ArgumentNullException | valueconstantType |
ArgumentException | value is not an instance of a valid constant type constantType does not represent a primitive type, value is of a different primitive type than that represented by constantType. |