locked
How to map a view in EF4? RRS feed

  • Question

  • I have a table "Results" (ResultId, ResultValue, CompetitionId) which are results for a competition. I have made a view "ResultPlacements" (ResultId, Placement). I want to map this in EF4 and did a succesfull mapping where I created a scalar value on "Result"-entity and mapped it the "Placement" on the corresponding view-row. The "Result"-entity was therefor mapped to both the table and the view. This failed when trying to add result-entities, as EF did not know what to do with the View as it is read only.

    My second solution was to map the view  as an association to the entity. This gives me other errors and EF complaints about the id of the view is referenced multiple places.

     

    Do you guys have any ideas how to map my tables/views? I do not want to recalculate the placement everytime a result is changed/inserted.

    Saturday, December 11, 2010 5:06 PM

Answers

All replies