DbExpressionBuilder.Constant Method

 

Creates a new DbConstantExpression of the specified primitive type with the given constant value.

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

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticConstant(Object)

Creates a new DbConstantExpression with the given constant value.

System_CAPS_pubmethodSystem_CAPS_staticConstant(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.

public static DbConstantExpression Constant(
	object value
)

Parameters

value
Type: System.Object

The constant value to represent.

Return Value

Type: System.Data.Entity.Core.Common.CommandTrees.DbConstantExpression

A 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.

public static DbConstantExpression Constant(
	this TypeUsage constantType,
	object 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.DbConstantExpression

A 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.