Help shape the future of CMS PaaS release notes! Take this quick survey and share your feedback.
Help shape the future of CMS PaaS release notes! Take this quick survey and share your feedback.
Hi,
This is a known issue which does not yet have a publicly released fix. You can get a hotfix through EPiServer Support.
We will look into why this is not in the bug list.
/Håkan
You can try this workaround - not very nice but seems to work well:
using System;
using System.Linq;
using EPiServer.Common.Visits;
namespace Utils
{
public class VisitHandlerFix
{
private const int MaxItemCount = 10000;
public static VisitableEntityCollection GetVisitedItems<T>(int page, int pageSize, TimeSpan explicitCacheExpiration, out int totalItems, params VisitableEntitySortOrder[] sortOrder)
{
// bugfix:
VisitableEntityCollection everything = VisitHandler.GetVisitedItems(typeof(T), 1, MaxItemCount, explicitCacheExpiration, out totalItems, sortOrder);
VisitableEntityCollection filtered = new VisitableEntityCollection(everything.OfType<T>().ToList());
totalItems = filtered.Count;
return new VisitableEntityCollection(filtered.Skip(pageSize * (page - 1)).Take(pageSize).ToList());
}
}
}
I'm am using visithandler to count visit for two visitable entities, namely Entry and Blog. The following code is used for this...
VisitHandler.AddVisit(new EPiServer.Common.Visits.Visit(_blog, new UserAuthor(CurrentUser)));
VisitHandler.AddVisit(new EPiServer.Common.Visits.Visit(_entry, new UserAuthor(CurrentUser)));
When trying to receive Entry visits i also receive Blog visits and vice versa, this has to be a bug? I can't find anything in the bug list. The following code is used.
VisitableEntityCollection visitedItems = VisitHandler.GetVisitedItems(typeof(Entry), 1,
1000, TimeSpan.MinValue, out totalItems, new VisitableEntitySortOrder(VisitableEntitySortField.NumVisits, SortingDirection.Descending))