When returning a collection of items in a Sitefinity CMS web service, you should always wrap that collection inside of a CollectionContex<T> object, which provides service client with some additional information about the collection.
The following diagram illustrates CollectionContext<T> class:
CollectionContext is a generic type, so when declaring it we need to specify the generic argument which is the type of the items this collection holds.
For example, if we are returning a collection of ResourceEntry objects, we would declare CollectionContext object as follows: CollectionContext<ResourceEntry> on the other hand, if our collection is made of Product object, we would declare CollectionContext object like this:
CollectionContext class has three public properties:
var manager = Res.GetManager(provider);
CultureInfo cultureInfo = GetCultureInfo(cultureName);
var query = from resoruce
where resoruce.ClassId == classId
// extender takes care of it.
query = query.OrderBy(sort);
// this is where the quer the query is executed.
totalCount = query.Count();
// wont fire the process again, when marked as IEnumerable.
var items = query.AsEnumerable().Skip(skip).Take(take);
var collectionContext =
TotalCount = totalCount
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important
Copyright © 2022 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.
Progress, Telerik, Ipswitch, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.
Powered by Progress Sitefinity