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
Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.