Sorry this is quite a vague question. Been trying to find information on using a View with Entity Framework 4. Want to use开发者_如何转开发 it as a read only view, no interested in inserting/updating/deleting... Would just like to use a POCO with a view...
[Update]
Thanks to the responders. Zeeshan, actually reading your book currently.
I can add a view via the "Update Model from Database" menu item and works great. Just need to figure out how to setup the associations now...
Views are fully supported in RTM. One nice feature sneaked in very late in the product life cycle is, you can customize the key of the view from the conceptual model and it will sync it with the storage model as well. However there is still paint point with View where it needs to be mapped to an entity which must have a key. In future a view may be allowed to get mapped to a complex type. You can also use ExecuteStoreQuery for better performance.
You can add views to the Entity Designer the same way you do with tables, then treat the views as entities themselves. They're not treated exactly the same internally, and you may have to do some editing of the underlying XML.
Your question isn't clear on whether you're looking specifically for the difference between views in 3.5 and 4.0, but if you're looking for a general discussion of how views work in EF, this link has some information about it (based on 3.5):
Entity Framework: Creating a model using views instead of tables
精彩评论