We have a custom endpoint that wraps the IEventService and calls into "GetEvents", which is the 4th overload to this method, accepting calendarId, filterTags, logicallyOrTags, pageSize, pageIndex.
When integration testing this via the REST console, I have 3 events each with different tags. Let's say Event 1 is tagged "X". Event 2 is tagged "Y". Event 3 is tagged "Z".
When I query this endpoint for all events with tag "X", it returns Event 1 (expected). When I query this endpoint for all events with tag "Y", it sill returns Event 1 (unexpected), unless I vary the "LogicallyOrTags" boolean parameter to this method on each method invocation or rest request.
It seems that the service call's response is somehow cached internally.
Or, could it be that the IEventService IOC binding in the CalendarModule.config is in "singleton" scope? (I wouldn't think this b/c pretty much all the bindings appear to be singleton scoped)
This is the custom endpoint code:
public CalendarEventListResponse List(CalendarEventListRequest request)
{
CalendarEventListResponse response = new CalendarEventListResponse(request);
PagedList<CalendarEvent> events = new PagedList<CalendarEvent>();
try
{
IEventService svc = Telligent.Common.Services.Get<IEventService>();
PagedSet<Event> items = new PagedSet<Event>();
if (!string.IsNullOrEmpty(request.TagString))
{
string[] tags = request.TagString.Split(',');
items = svc.GetEvents(request.CalendarId, tags, request.LogicallyOrTags, Convert.ToInt32(request.PageIndex), Convert.ToInt32(request.PageSize));
}
else
{
EventQuery q = new EventQuery(new User());
q.QueryType = EventQueryType.NotSet;
q.CalendarId = request.CalendarId;
q.CalendarReferenceId = request.CalendarId;
q.PageIndex = 0;
items = svc.GetEvents(q);
}
foreach (Event evt in items)
{
CalendarEvent commEvt = Mapper.Map<Event, CalendarEvent>(evt);
commEvt.EventTags = string.Empty;
foreach (string tagstr in evt.Tags)
{
commEvt.EventTags += tagstr + ",";
}
if (commEvt.EventTags.Trim().EndsWith(","))
{
commEvt.EventTags = commEvt.EventTags.Remove(commEvt.EventTags.Length - 1);
}
events.Add(commEvt);
}
}
catch (Exception ex)
{
response.Errors.Add(ex.Message);
}
if (events != null)
{
response.CalendarEvents = events;
}
else
{
response.Errors.Add("Unable to retrieve CalendarEvents");
}
return response;
}