本文整理汇总了C#中Exceptionless.Core.Models.PersistentEvent.GetSessionId方法的典型用法代码示例。如果您正苦于以下问题:C# PersistentEvent.GetSessionId方法的具体用法?C# PersistentEvent.GetSessionId怎么用?C# PersistentEvent.GetSessionId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Exceptionless.Core.Models.PersistentEvent
的用法示例。
在下文中一共展示了PersistentEvent.GetSessionId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetEventSummaryData
public override SummaryData GetEventSummaryData(PersistentEvent ev) {
if (!ShouldHandle(ev))
return null;
dynamic data = new ExpandoObject();
data.SessionId = ev.GetSessionId();
data.Type = ev.Type;
if (ev.IsSessionStart()) {
data.Value = ev.Value.GetValueOrDefault();
DateTime? endTime = ev.GetSessionEndTime();
if (endTime.HasValue)
data.SessionEnd = endTime;
}
var identity = ev.GetUserIdentity();
if (identity != null) {
if (!String.IsNullOrEmpty(identity.Identity))
data.Identity = identity.Identity;
if (!String.IsNullOrEmpty(identity.Name))
data.Name = identity.Name;
}
return new SummaryData { TemplateKey = "event-session-summary", Data = data };
}
示例2: GetHeartbeatAsync
private async Task<HeartbeatResult> GetHeartbeatAsync(PersistentEvent sessionStart) {
string sessionId = sessionStart.GetSessionId();
if (!String.IsNullOrWhiteSpace(sessionId)) {
var result = await GetLastHeartbeatActivityUtcAsync($"project:{sessionStart.ProjectId}:heartbeat:{sessionId.ToSHA1()}");
if (result != null)
return result;
}
var user = sessionStart.GetUserIdentity();
if (String.IsNullOrWhiteSpace(user?.Identity))
return null;
return await GetLastHeartbeatActivityUtcAsync($"project:{sessionStart.ProjectId}:heartbeat:{user.Identity.ToSHA1()}");
}
示例3: GetEventSummaryData
public override SummaryData GetEventSummaryData(PersistentEvent ev)
{
if (!ShouldHandle(ev))
return null;
var data = new Dictionary<string, object> { { "SessionId", ev.GetSessionId() }, { "Type", ev.Type } };
AddUserIdentitySummaryData(data, ev.GetUserIdentity());
if (ev.IsSessionStart()) {
data.Add("Value", ev.Value.GetValueOrDefault());
DateTime? endTime = ev.GetSessionEndTime();
if (endTime.HasValue)
data.Add("SessionEnd", endTime);
}
return new SummaryData { TemplateKey = "event-session-summary", Data = data };
}