comments to the tutorial

May 10, 2010 at 6:20 AM

I've gone through tutorial v 0.8, and got my old editor pen. Here are the comments (pages are as in PDF; pagination in the document is off by 1):

page 11: /App_Data is not created

page 44: Public class StoreManagerController; not StoreController

page 44: .Include("Genre").Include("Artist") is no longer necessary thanks to lazy loading that EF4 generates by default

page 44: return View(albums); Of course, you can also use return View(storeDB.Albums) - and I would argue that it's a better approach - but the first operator (var albums =) is not necessary

page 46: "Create new album" disappeared from the aspx code

page 58: Create function should be public ActionResult Create([Bind(Prefix="Album")] Album album) - Bind is missing

page 62: are you making AlbumMetaData an internal class intentionally? You do it twice; so I assume the answer is "yes" - but you don't explain why; and all other examples (ScottGu, Brad Wilson) don't use internal class.

These are mostly simple errors. I have more general comments; but I'll save those for another post :)

Coordinator
May 11, 2010 at 6:53 AM

Thanks, @virshu. Will update with your fixes. A few places where things are written as intended:

  • p. 44 - We're intentionally using eager loading rather than lazy loading of related entities for efficiency, since we know we will be retrieving related entities. This is more efficient since it allows EF to get everything in one database transaction rather than requiring two or more database trips
  • p. 62 - Yes, I'm using internal classes. I had a long review meeting with Scott Guthrie and Scott Hanselman, and we all agreed that this format looked a little cleaner.