Question

i'm looking to load a list of object with their child graph in subsonic. I know how to do it using linq to sql with dataloadoptions

i have this graph

product - location - prices

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

I would like for my product object to preload location and prices, so that they would not lazy load causing many query.

thanks

Was it helpful?

Solution

I use the RepositoryRecord in SubSonic which is "mostly" poco. Then I make partials for those classes that load the other class when a property is selected. Besides, loading one record from the database is faster and easier than loading them all at once.

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top