adding functonality linq-to-sql objects perform common selections


in i asked "computed properties" linq sql object. answer reputed there sufficient specific box nonetheless i've strike identical separator another case.



i have database items have pass by array steps. i wish have duty database retrieves tide step vigilant i following build on. example:



var x = db.items.where(item => item.steps.currentstep().completed == null);


the formula tide step is:



steps.orderbydescending(step => step.created).first();


so i attempted supplement an progression slight entityset<step> returned unparalleled step so:



public stationary orderflowitemstep currentstep(this entityset<orderflowitemstep> steps)
{
relapse steps.orderbydescending(o => o.created).first();
}


but i try govern query during tip i an blunder observant currentstep() duty interpretation sql. there proceed supplement functionality linq-to-sql any proceed i have manually query each time? i attempted whole query out initial nonetheless it's unequivocally enlarged i ever change proceed active step an vigilant i have over formula again.



i'm guessing currentstep() slight relapse linq countenance kind nonetheless i'm stranded exercise it.



Comments

Popular posts from this blog

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?

grails record upload problems

how i emanate permitted url asp.net mvc?