EdmFunctions.DiffMonths Method (DbExpression, DbExpression)
Creates a DbFunctionExpression that invokes the canonical 'DiffMonths' function with the specified arguments, which must each have a DateTime or DateTimeOffset result type. The result type of dateValue1 must match the result type of dateValue2. The result type of the expression is Edm.Int32.
Assembly: EntityFramework (in EntityFramework.dll)
public static DbFunctionExpression DiffMonths( this DbExpression dateValue1, DbExpression dateValue2 )
Parameters
- dateValue1
-
Type:
System.Data.Entity.Core.Common.CommandTrees.DbExpression
An expression that specifies the first DateTime or DateTimeOffset value.
- dateValue2
-
Type:
System.Data.Entity.Core.Common.CommandTrees.DbExpression
An expression that specifies the DateTime or DateTimeOffset for which the month difference from dateValue1 should be calculated.
Return Value
Type: System.Data.Entity.Core.Common.CommandTrees.DbFunctionExpressionA new DbFunctionExpression that returns the month difference between dateValue1 and dateValue2.
Exception | Condition |
---|---|
ArgumentNullException | dateValue1 or dateValue2 is null |
ArgumentException | No overload of the canonical 'DiffMonths' function accepts arguments with the result types of dateValue1 and dateValue2. |