code_junkie

How do you avoid the n+1 problem with SubSonic?

Nov 13th, 2011
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. foreach (BlogPost post in blogposts)
  2. {
  3. foreach (Comment comment in post.Comments)
  4. {
  5. // Do something
  6. }
  7. }
  8.  
  9. Partial Public Class Book
  10.  
  11. Private _Author as Database.Author
  12. Property Author() as Database.Author
  13. Get
  14. If _Author is nothing then
  15. ' Load the author class here.
  16. End if
  17. return _Author
  18. End get
  19. Set
  20. '....
  21. End Set
  22. End Property
  23.  
  24. End Class
Add Comment
Please, Sign In to add comment