private static RequestInfo CreateRequestInfo() { var requestInfo = new RequestInfo(); requestInfo.Url = new Uri("http://medseek.com/home.aspx"); requestInfo.SessionId = new string('x', 10); requestInfo.VisitorIdentifier = Guid.NewGuid(); return requestInfo; }
private static RequestInfo CreateRequestInfo() { var requestInfo = new RequestInfo(); requestInfo.SessionId = new string('x', 10); requestInfo.VisitorIdentifier = Guid.NewGuid(); requestInfo.IPAddress = "127.0.0.1"; requestInfo.UrlReferrer = new Uri("http://www.google.com"); requestInfo.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.83 Safari/535.11"; return requestInfo; }
/// <summary> /// Finds the or create visit. /// </summary> /// <param name="requestInfo">The request info.</param> /// <returns></returns> public Visit FindOrCreateVisit(RequestInfo requestInfo) { if (requestInfo == null) { throw new ArgumentNullException("requestInfo"); } var visit = Visits .OrderByDescending(v => v.Id) .FirstOrDefault(v => v.SessionId == requestInfo.SessionId); if (visit == null) { visit = new Visit(this, requestInfo); this.Visits.Add(visit); } return visit; }
public Visit(Visitor visitor, RequestInfo requestInfo) : this() { if (visitor == null) { throw new ArgumentNullException("visitor"); } if (requestInfo == null) { throw new ArgumentNullException("requestInfo"); } Visitor = visitor; SessionId = requestInfo.SessionId; IPAddress = requestInfo.IPAddress ?? string.Empty; UserAgent = requestInfo.UserAgent ?? string.Empty; if (requestInfo.UrlReferrer != null) { UrlReferrer = requestInfo.UrlReferrer.ToString(); } }