c# - Entity Framework 4 Code Genning - One Set of Entities? -
i looking setup architecture entity framework break apart entities multiple models. wondering if possible code-generate 1 set of entities, each model uses same set of data access classes? realize issue contexts, wondering if each context needed have own set of classes, or can create many contexts have 1 set of classes represent backend tables, using self-tracking entities generation feature.
thanks.
you can share poco classes across multiple models.
for example class this:
public class person { public int id {get;set;} public string firstname {get;set;} public string surname {get;set;} public string lastname {get {return surname;} set {surname = value;}} }
would work in edmx defines person
id,firstname,surname
, work in second edmx defines person
id,firstname,lastname
not sure though self-tracking entities, stes 'poco' have model specific code might break if definition of entitytype different in 2 edmxs (like in above sample).
you'd have try out.
hope helps
alex (former ef team member)
Comments
Post a Comment