how to retrieve data with fields sorted ascending

Jul 1, 2014 at 11:54 AM
I would like to retrieve data in a query with my fields sorted ascending. There is nothing in the documentation on specifying a sort order. How can this be done using ORM?
Jul 1, 2014 at 4:53 PM
It depends on a few factors, but primarily on the amount of data (number of rows) you're retrieving. The Fetch method allows for a sort order of a given field, but generally speaking I retrieve the rows I need, then use LINQ to order them for display.
Jul 1, 2014 at 6:03 PM
thanks for your reply.

as a new user, i am a little confused.

I am doing the following to get a list of type category:
public AssetCategory[] GetAllParentCategories()
        return m_store.Select<AssetCategory>(c => c.ParentID.Equals(0)).ToArray();
and it is working nicely as is. But one of the fields is CategoryName, and I would like my list to be in sort order by Category Name.

Where wouuld i specify the linq command to do that? Your select command does not seem to have a field to order by in your class definition.

I am doing this using SQLite, and there are about 100 records to retrieve.

I want to do this efficiently.
Jul 2, 2014 at 1:43 PM
Something along these lines:
return m_store.Select<AssetCategory>(c => c.ParentID.Equals(0)).OrderBy(c=>c.CategoryName).ToArray();