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