Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在上下文中禁用了延迟加载,但现在在某些情况下,我想在我的代码中使用延迟加载,但不想通过上下文启用它。
有什么方法可以为特定的代码块启用它。
使用这个http://blogs.msdn.com/b/adonet/archive/2011/01/31/using-dbcontext-in-ef-feature-ctp5-part-6-loading-related-entities.aspx
// I use princesses because ponies are too mainstream var princesses2 = context.Princesses .Include("Unicorns") .ToList();
您只需包含关系