This project is read-only.

Query with Slice fails. Why??? stuck here

Topics: Writing modules
Jun 14, 2011 at 8:14 PM

Hi there,

I don't understand why the first query returns no results.
There are 3 published contentItems with the part I am looking for.
Second query works!

What could the problem be here? 

        protected override DriverResult Display(RecentEventsPart part, string displayType, dynamic shapeHelper)
            // get event list
            var staysEmpty = _orchardServices.ContentManager.Query<EventDatePart>(VersionOptions.Published).Slice(0, part.ItemCount);
            var works = _orchardServices.ContentManager.Query<EventDatePart>(VersionOptions.Published).List().Take(part.ItemCount);


Jun 14, 2011 at 8:33 PM

Got it to work:

events = _orchardServices.ContentManager.Query<EventDatePart, EventDateRecord>(VersionOptions.Published).OrderByDescending(date=>date.EventDate).Slice(0, part.ItemCount);

Was missing the TRecord part