Linq - Orderby not ordering

Posted by Billy Logan on Stack Overflow See other posts from Stack Overflow or by Billy Logan
Published on 2010-04-23T19:08:06Z Indexed on 2010/04/23 19:13 UTC
Read the original article Hit count: 532

Filed under:
|

Hello everyone, I have a linq query that for whatever reason is not coming back ordered as i would expect it to. Can anyone point me in the right direction as to why and what i am doing wrong?

Code is as follows:

List<TBLDESIGNER> designer = null;

using (SOAE strikeOffContext = new SOAE())
{
   //Invoke the query
   designer = AdminDelegates.selectDesignerDesigns.Invoke(strikeOffContext).ByActive(active).ByAdmin(admin).ToList();
}

Delegate:

public static Func<SOAE, IQueryable<TBLDESIGNER>> selectDesignerDesigns =
        CompiledQuery.Compile<SOAE, IQueryable<TBLDESIGNER>>(
        (designer) => from c in designer.TBLDESIGNER.Include("TBLDESIGN")
                      orderby c.FIRST_NAME ascending
                      select c);

Filter ByActive:

public static IQueryable<TBLDESIGNER> ByActive(this IQueryable<TBLDESIGNER> qry, bool active)
    {
        //Return the filtered IQueryable object
        return from c in qry
               where c.ACTIVE == active
               select c;

    }

Filter ByAdmin:

public static IQueryable<TBLDESIGNER> ByAdmin(this IQueryable<TBLDESIGNER> qry, bool admin)
{
    //Return the filtered IQueryable object
    return from c in qry
           where c.SITE_ADMIN == admin
           select c;

}

Wondering if the filtering has anything to do with it??

Thanks in advance, Billy

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about linq-to-entities