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 = AdminDelega开发者_运维知识库tes.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
Wondering if the filtering has anything to do with it??
Yes, a .Where(
is documented to discard any preceding .OrderBy(
in LINQ to Entities.
精彩评论