using contentManager.Query to get a list of contentparts by their id

Topics: Writing modules
May 15, 2011 at 11:06 AM

I want to retrieve a list of ContentParts based on their Ids.  I'm trying to use the ContentManager.Query<Part, PartRecord> interface (i.e. something like  .Where ( r=> someIDs.Contains( r.Id) )

Is that possible?  Everything I try is either a syntax error or throws an error relating to reaching  unreachable code.

May 15, 2011 at 11:42 AM

I do the following in Mechanics and it works fine:

            var connectorRightIds = connectors.Select(c => c.RightContentItemId).ToList();
            return Services.ContentManager.Query<SocketsPart, SocketsPartRecord>(types).Where(s => connectorRightIds.Contains(s.Id));