automatically supplement where clauses linq countenance tree
i am controlling entity horizon linq entities. i have combined little database settlement & horizon exercise versioning good localization. each entity consists twin 3 tables, (ie product, productbase & productlocal).
my linq always includes following boilerplate code:
from o db.product
from b o.base
from l o.local
where o.versionstatus == (int)versionstatus.active
&& b.versionstatus == (int)versionstatus.active
&& l.versionstatus == (int)versionstatus.active
&& l.versionlanguage == context.currentlanguage
select new productinstance { instance = o, bottom = b, internal = l }
what i accomplish spin above into:
(from o db.product
b o.base
l o.local
name new productinstance { instance = o, bottom = b, internal = l }).isactive()
or during worst, something like:
from o db.product.active()
from b o.base.active()
from l o.local.active()
select new productinstance { instance = o, bottom = b, internal = l }
i have extended bottom classes edm generates exercise interfaces make properties ( iversionstatus and/or iversionlanguage ). there proceed i transport countenance tree, check form countenance implements interface, following set versionstatus accordingly?
i woud adore rudimentary initial option, only reduction and/or forget. i have seen examples after fact, after the ienumerable, nonetheless i rather lift some-more database i need to.
thanks any tips!
Comments
Post a Comment