c# - Make Entity Framework Join table explicit, reduce code changes using partial classes and extension methods -
i need add additional field "implicit" entity framework join table - adding sort key. break large amount of code relies on classa.classbs , classa.add(itemb); etc.
is there route extension methods , partial classes minimise or remove other code changes ...
i've been trying figure out along lines of...
public partial class classa { public iqueryable<classb> classbs { { return this.joinab.select(x => x.classb).orderby(x => x.sortkey).asqueryable(); } } }
which results in "cannot converted store expression" type problems, , i'm not sure how "lefthandside" end of
public bool icollection<classa> add(classb itemtoadd, int sortkey=0){ var jab = new joinab{sortkey=sortkey, classb=itemtoadd}; this.*lefthandside*.add(jab); return true; }
so, possible @ all, if how?
Comments
Post a Comment