How map objects to a view with EF 4 code first?
问题 How can you map an entity to a database view with EF 4 code first? Is there a way to do this by deriving from the EntityConfiguration classes? 回答1: Yes! I found the answer: You can certainly use Code First to map to a view, just tell Code First that it's a table and it will use the same SQL against the view that it would for a table. Obviously if your view isn't writeable then saving is going to fail if you try and update values in the entities that are based on the view, but we will just