EF 4.1: Error after upgrade when mapping one entity to multiple tables -
after upgrading working project ef 4.0 4.1, receiving following error @ run-time:
map called more once type 'everybody' , @ least 1 of calls didn't specify target table name.
the code is:
public everybodyconfiguration() { map(e => e.properties(p => new { p.everybodyid, p.firstname, p.lastname, p.initials, p.capsid, p.datemodified })).totable("everybody"); map(e => e.properties(p => new { p.everybodyid, p.status })).totable("everybodystatus"); map(e => e.properties(p => new { p.everybodyid, p.email, p.bouncedflag, p.donotcontactflag })).totable("everybodyemail"); }
the error message confusing, because indicates table name hasn't been specified somewhere, can see in code has.
the tables have same primary key column name.
any suggestions?
the totable
call mapping whole entity (chained behind map
, method of entitytypeconfiguration
). must use totable
method of entitymappingconfiguration
parameter of action
passed map
:
public everybodyconfiguration() { map(c => { c.properties(p => new { p.everybodyid, p.firstname, p.lastname, p.initials, p.capsid, p.datemodified }); c.totable("everybody"); }); map(c => { c.properties(p => new { p.everybodyid, p.status }); c.totable("everybodystatus"); }); map(c => { c.properties(p => new { p.everybodyid, p.email, p.bouncedflag, p.donotcontactflag }); c.totable("everybodyemail"); }); }
Comments
Post a Comment