C# Linq DBML Class Wrapper -
i have generic class extends linq class. means can't extend linq class, need have separate generic class.
public linqcake // linq class dbml { string name; frostingtype type; } public class cake<t> : linqcake t frostingtype { public bool someproperty { { return linqcake.type == frostingtype; } } // want this, // can't because code isn't valid public cake (int id) { = db.linqcakes.where(x=>x.id = id).single(); } } public void main() { cake<chocolate> chocolatecake = cake<chocolate>(7); console.writeline(chocolatecake.someproperty); }
i want populate cake's inherited class linqcake information database. can implicit cast?
how accomplish spirit of i'm trying do? can think of 2 ways of sort of doing this; a) add private linqcake member b) read in each property of linqcake class duplicate properties of cake class.
i feel there better solution, idea?
if understand question doing projection here involves mapping fields type linqcake
of type cake
. can't set linqcake
cake
because isn't specified in type hierarchy.
maybe tool automapper can you.
Comments
Post a Comment