How can I lazy load an association (EntitySet) in LINQ to SQL? You can't set Delay Loaded on Associations in the designer, and I couldn't find a DBML attribute for it either. I looked at DataLoadOptions to see if there was a way to lazy load them that way, but DataLoadOptions really just provides a way to mold the SQL that is generated for properties and associations (and force loading of lazy loaded properties).
This is a very important feature for us, as we have a pretty heavy object graph that gets pushed to the DB. When loading some of the top level objects, I don't want to load their associated sub-entities until the user actually requests that data. It's easy to do for individual properties, but I can't find a way to do it for associations. The EntitySet collection seems to support the concept, so there has to be a way.
默认情况下,Linq中的SQL启用了延迟加载-使用EntitySet和EntityRef支持此功能。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.