c# - Mapping data from 2 tables to 1 entity - Entity Framework 4 -
i stuck here.
is possible map data 2 different tables 1 entity in entity framework 4.
i have bunch of employees in 1 table, , in other have som project information. combine these 2 tables in 1 entity, , keep tracking features etc., possible?
i not want use function import, solely through entity model.
can - when try it, following error time:
error 3024: problem in mapping fragments starting @ line 2354:must specify mapping key properties (myprojecttable.psinitials, myprojecttable.projectid) of entityset myprojecttable.
both key mapped respective tables. new entity made myprojecttable basetable.
the relation between 2 tables 1-*
hope can help.
/christian
you cannot map 2 tables one-to-many relationship 1 entity. if don't want projecting results 1 object in code, consider creating view , mapping instead.
according http://msdn.microsoft.com/en-us/library/bb896233.aspx
you should map entity type multiple tables if following conditions true:
the tables mapping share common key.
the entity type being mapped has entries in each underlying table. in other words, entity type represents data has one-to-one correspondence between two
tables; entity type represents inner join of 2 tables.
Comments
Post a Comment