Entity Framework 4 POCO - Lazy + Eager Loading
I have the following DB structure (simplified version):
Comments - CommentId, UserId
Users - UserId
UserDetails - UserId, Address, Phone, etc.
I am using EF 4
with PO开发者_如何学PythonCOs
. The User
property of the Comment
class is marked as virtual
(to enable lazy loading for it). However, I want when the User
property is loaded (lazy) also its UserDetails
property to be loaded (the relation Users - UserDetails is 1:1). Is that possible? Can I specify it in some way? I want to make lazy + eager loading in some way..
No, you can't do that. You can, however, turn multiple tables into a single entity using the entity splitting technique. Sounds like that's what you're really after.
精彩评论