DbFunctions.DiffMinutes 方法 (Nullable<DateTime>, Nullable<DateTime>)
[此頁面專屬於 Entity Framework 第 6 版。最新版本可從 'Entity Framework' NuGet 套件取得。如需 Entity Framework 的詳細資訊,請參閱 msdn.com/data/ef。]
用於 LINQ to Entities 查詢時,此方法會叫用標準 EDM 函式 DiffMinutes 以計算兩個日期/時間的相距分鐘數。
命名空間: System.Data.Entity
組件: EntityFramework (在 EntityFramework.dll 中)
語法
'宣告
<DbFunctionAttribute("Edm", "DiffMinutes")> _
<SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId := "timeValue2")> _
<SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId := "timeValue1")> _
Public Shared Function DiffMinutes ( _
timeValue1 As Nullable(Of DateTime), _
timeValue2 As Nullable(Of DateTime) _
) As Nullable(Of Integer)
'用途
Dim timeValue1 As Nullable(Of DateTime)
Dim timeValue2 As Nullable(Of DateTime)
Dim returnValue As Nullable(Of Integer)
returnValue = DbFunctions.DiffMinutes(timeValue1, _
timeValue2)
[DbFunctionAttribute("Edm", "DiffMinutes")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "timeValue2")]
[SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "timeValue1")]
public static Nullable<int> DiffMinutes(
Nullable<DateTime> timeValue1,
Nullable<DateTime> timeValue2
)
[DbFunctionAttribute(L"Edm", L"DiffMinutes")]
[SuppressMessageAttribute(L"Microsoft.Usage", L"CA1801:ReviewUnusedParameters", MessageId = L"timeValue2")]
[SuppressMessageAttribute(L"Microsoft.Usage", L"CA1801:ReviewUnusedParameters", MessageId = L"timeValue1")]
public:
static Nullable<int> DiffMinutes(
Nullable<DateTime> timeValue1,
Nullable<DateTime> timeValue2
)
[<DbFunctionAttribute("Edm", "DiffMinutes")>]
[<SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "timeValue2")>]
[<SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "timeValue1")>]
static member DiffMinutes :
timeValue1:Nullable<DateTime> *
timeValue2:Nullable<DateTime> -> Nullable<int>
public static function DiffMinutes(
timeValue1 : Nullable<DateTime>,
timeValue2 : Nullable<DateTime>
) : Nullable<int>
參數
- timeValue1
類型:System.Nullable<DateTime>
第一個日期/時間。
- timeValue2
類型:System.Nullable<DateTime>
第二個日期/時間。
傳回值
類型:System.Nullable<Int32>
第一個和第二個日期/時間的相距分鐘數。
備註
您不可以直接呼叫此函式。 此函式只能出現在 LINQ to Entities 查詢內。 此函式會轉譯為資料庫中的對應函式。