EntityFunctions.AddYears Method
Invokes the canonical AddYears EDM function to add the given number of years to a date/time when used a part of a LINQ to Entities query.
Assembly: EntityFramework (in EntityFramework.dll)
Name | Description | |
---|---|---|
![]() ![]() | AddYears(Nullable<DateTime>, Nullable<Int32>) | When used as part of a LINQ to Entities query, this method invokes the canonical AddYears EDM function to add the given number of years to a date/time. |
![]() ![]() | AddYears(Nullable<DateTimeOffset>, Nullable<Int32>) | When used as part of a LINQ to Entities query, this method invokes the canonical AddYears EDM function to add the given number of years to a date/time. |
EntityFunctions.AddYears Method (Nullable<DateTime>, Nullable<Int32>)
When used as part of a LINQ to Entities query, this method invokes the canonical AddYears EDM function to add the given number of years to a date/time.
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "dateValue")] [SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "addValue")] [DbFunctionAttribute("Edm", "AddYears")] public static Nullable<DateTime> AddYears( Nullable<DateTime> dateValue, Nullable<int> addValue )
Parameters
- dateValue
-
Type:
System.Nullable<DateTime>
The input date/time.
- addValue
-
Type:
System.Nullable<Int32>
The number of years to add.
You cannot call this function directly. This function can only appear within a LINQ to Entities query. This function is translated to a corresponding function in the database.
EntityFunctions.AddYears Method (Nullable<DateTimeOffset>, Nullable<Int32>)
When used as part of a LINQ to Entities query, this method invokes the canonical AddYears EDM function to add the given number of years to a date/time.
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "dateValue")] [SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "addValue")] [DbFunctionAttribute("Edm", "AddYears")] public static Nullable<DateTimeOffset> AddYears( Nullable<DateTimeOffset> dateValue, Nullable<int> addValue )
Parameters
- dateValue
-
Type:
System.Nullable<DateTimeOffset>
The input date/time.
- addValue
-
Type:
System.Nullable<Int32>
The number of years to add.
You cannot call this function directly. This function can only appear within a LINQ to Entities query. This function is translated to a corresponding function in the database.