DbExpressionBuilder.Constant Method (TypeUsage, Object)

.NET Framework (current version)
 

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

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

public static DbConstantExpression Constant(
	this TypeUsage constantType,
	object value
)

Parameters

constantType
Type: System.Data.Metadata.Edm.TypeUsage

The type of the constant value.

value
Type: System.Object

The constant value to represent.

Return Value

Type: System.Data.Common.CommandTrees.DbConstantExpression

A new DbConstantExpression with the given value and a result type of constantType.

Exception Condition
ArgumentNullException

value or constantType is null.

ArgumentException

value is not an instance of a valid constant type, constantType does not represent a primitive type, or value is of a different primitive type than that represented by constantType.

.NET Framework
Available since 4.5
Return to top
Show: