SQL Server vs LINQ views for querying objects using EF Code First

The question is only related to the first code of Entity Framework 5. What is the best option (performance and scalability):

  • Create SQL Server views, consider them as DbSets in DbContext .

  • Create custom classes that represent view models; use Linq to Entities to model the Entity model to view the model before executing the query.

+4
source share
1 answer

Well, it depends on how big your request is, if it is huge and requires a lot of precessions. I suggest you create a view this way, all the hard work will be on SQL Server, and your application will be much faster to process.

I recommend using virtual classes instead of creating a new one, because you will have all the functionality of the entity. check this link

What effects can the virtual keyword have in Entity Framework 4.1 POCO Code First?

Hope for this help

0
source

Source: https://habr.com/ru/post/1447144/


All Articles