EdmFunctions.AddYears Method (DbExpression, DbExpression)

 

Creates a DbFunctionExpression that invokes the canonical 'AddYears' function with the specified arguments, which must have DateTime or DateTimeOffset and integer result types. The result type of the expression is the same as the result type of dateValue.

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

public static DbFunctionExpression AddYears(
	this DbExpression dateValue,
	DbExpression addValue
)

Parameters

dateValue
Type: System.Data.Entity.Core.Common.CommandTrees.DbExpression

An expression that specifies the value to which addValue should be added.

addValue
Type: System.Data.Entity.Core.Common.CommandTrees.DbExpression

An expression that specifies the number of years to add to dateValue.

Return Value

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

A new DbFunctionExpression that adds the number of years specified by addValue to the value specified by dateValue.

Exception Condition
ArgumentNullException

dateValue or addValue is null.

ArgumentException

No overload of the canonical ‘AddYears’ function accepts arguments with the result types of dateValue and addValue.