I'm using Entity Framework 4.3 and I'd like to create a view because of the low performance of some selects. Is possible to do it from code?
Asked
Active
Viewed 90 times
1
-
If it was code first, then what would the view be a projection of? I would look into lazy loading of entities. – Davin Tryon Aug 14 '13 at 13:20
1 Answers
2
Peter Kellner has mentioned in his article:
With CodeFirst, making views is problematic because you are not actually creating your own tables and columns so going directly into the database is really not something you should do. Creating a view basically violates one of the main purposes of CodeFirst which is to remove you from having to see database details. Making a view now tightly binds your model to that view and if you change you model and not the view you are in for trouble.
For more information visit Entity Framework Code First From Microsoft, Best and Worst Practices and How do I define a database view using Entity Framework 4 Code-First?

Community
- 1
- 1

Abbas Amiri
- 3,074
- 1
- 23
- 23