RuleFiringRecord 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
表示衍生自 WebManagementEvent 類別並實作 IWebEventCustomEvaluator 介面的事件引發記錄。
public ref class RuleFiringRecord sealed
public sealed class RuleFiringRecord
type RuleFiringRecord = class
Public NotInheritable Class RuleFiringRecord
- 繼承
-
RuleFiringRecord
範例
下列程式碼範例示範如何在 RuleFiringRecord 傳遞至 CanFire 方法時使用 。
// Implements the IWebEventCustomEvaluator.CanFire
// method. It is called by the ASP.NET if this custom
// type is configured in the profile
// element of the healthMonitoring section.
public bool CanFire(
System.Web.Management.WebBaseEvent e,
RuleFiringRecord rule)
{
bool fireEvent;
string lastFired = rule.LastFired.ToString();
string timesRaised = rule.TimesRaised.ToString();
// Fire every other event raised.
fireEvent =
(rule.TimesRaised % 2 == 0) ? true : false;
if (fireEvent)
{
firingRecordInfo =
string.Format("Event last fired: {0}",
lastFired) +
string.Format(". Times raised: {0}",
timesRaised);
}
else
firingRecordInfo =
string.Format(
"Event not fired. Times raised: {0}",
timesRaised);
return fireEvent;
}
' Implements the IWebEventCustomEvaluator.CanFire
' method. It is called by the ASP.NET if this custom
' type is configured in the profile
' element of the healthMonitoring section.
Public Function CanFire( _
ByVal e As System.Web.Management.WebBaseEvent, _
ByVal rule As RuleFiringRecord) As Boolean _
Implements System.Web.Management.IWebEventCustomEvaluator.CanFire
Dim fireEvent As Boolean
Dim lastFired As String = _
rule.LastFired.ToString()
Dim timesRaised As String = _
rule.TimesRaised.ToString()
' Fire every other event raised.
fireEvent = _
IIf(rule.TimesRaised Mod 2 = 0, True, False)
If fireEvent Then
firingRecordInfo = String.Format( _
"Event last fired: {0}", lastFired) + _
String.Format( _
". Times raised: {0}", timesRaised)
Else
firingRecordInfo = String.Format( _
"Event not fired. Times raised: {0}", _
timesRaised)
End If
Return fireEvent
End Function 'CanFire
備註
類別 RuleFiringRecord 提供可用來判斷是否應該記錄事件引發的資訊。
屬性
LastFired |
取得上次引發事件的時間。 |
TimesRaised |
取得事件引發的總次數。 |
方法
Equals(Object) |
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
GetHashCode() |
做為預設雜湊函式。 (繼承來源 Object) |
GetType() |
取得目前執行個體的 Type。 (繼承來源 Object) |
MemberwiseClone() |
建立目前 Object 的淺層複製。 (繼承來源 Object) |
ToString() |
傳回代表目前物件的字串。 (繼承來源 Object) |