c# - One Entity 2 Tables in EF Core 2.0 -
with ef core 2.0 possible map 1 entity in 2 tables?
something similar in ef6 (the 2 configurations equal, samples).
protected override void onmodelcreating(modelbuilder modelbuilder) { modelbuilder.applyconfiguration(delegate(entitymappingconfiguration<student> studentconfig) { studentconfig.properties(p => new { p.id, p.studentname }); studentconfig.totable("studentinfo"); }); action<entitymappingconfiguration<student>> studentmapping = m => { m.properties(p => new { p.id, p.height, p.weight, p.photo, p.dateofbirth }); m.totable("studentinfodetail"); }; modelbuilder.entity<student>().map(studentmapping); }
ef core 2.0 adds table splitting , owned types (ef6 complex types replacement), asking - entity splitting, still not supported.
there open feature request relational: entity splitting support #620 in githib repository, don't see concrete plan/schedule if , when implemented. when add tph inheritance support, that's speculation.
Comments
Post a Comment