Skip to content

Tip On ILists in getting Items from collection in the class

December 5, 2012

Here is a short tip for creating a virtual method for obtaining a collection of stored objects based on the NHibernate Mapping within the class.

If for instance you have an IList inside the class Group which is m_GroupMembership containing a list of customers, you can call the list from a virtual method with the possibility to skip records and take a number of records, heres how to skip a set number of records by the variable records, and takes 200 records from that selected index: –

public virtual IList<Customer> GetGroupMembership(int record)
{
return (IList<Customer>) m_GroupMembership.OrderBy(i => i).Skip(record).Take(200);
}

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: