0

我正在寻找以亚音速加载带有子图的对象列表。我知道如何使用 linq to sql 和 dataloadoptions

我有这张图

产品-位置-价格

新的 Select().From().Where(Product.Columns.Id).IsEqualTo(productId).ExecuteSingle();

我想让我的产品对象预加载位置和价格,这样它们就不会延迟加载导致很多查询。

谢谢

4

1 回答 1

1

我在 SubSonic 中使用 RepositoryRecord,它“主要是”poco。然后,我为那些在选择属性时加载另一个类的类制作部分内容。此外,从数据库中加载一条记录比一次加载所有记录更快、更容易。

Partial Public Class Book

    Private _Author as Database.Author 
    Property Author() as Database.Author
      Get
         If _Author is nothing then
           ' Load the author class here.
         End if
         return _Author
      End get
      Set
         '....
      End Set
    End Property

End Class
于 2009-04-04T10:30:55.637 回答