Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: EF5.0
hi
how to create view in entity framework(ef)
Posted 8-Mar-13 23:01pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You need to create Views using SQL query. Post that use it with EF.
 
Refer: How to Use SQL Server Views with the Entity Framework[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Do you really need views? With LINQ to Entities[^] you can write queries in managed code on top of the entity sets themselves (tables on the other side). The query will be transformed to actual sql query statements only when it is enumerated (this is called deferred execution). And as views are evaluated at runtime too (there is a little preprocessing, but not much) - in general you won't gain a lot. So, although you can use the database side views in your EF model (as Sandeep Mewara pointed out), you have to consider if you really need them.
Think like this: in the traditional development, the lot of the business logic is put on dbms side (views and stored procedures are in general such things), so the BL is split between two or more tires. The EF philosophy is treating the database more like a simple datastore, and is pushing the developer to forge the BL above the data access layer (with the application level entities in mind) - and not split or even below DAL.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 350
1 Jochen Arndt 150
2 PIEBALDconsult 110
3 Richard MacCutchan 105
4 Sergey Alexandrovich Kryukov 104
0 OriginalGriff 6,055
1 DamithSL 4,621
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,500
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 9 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100