This project is read-only.

Best Practices

  • Create the SPDataContext as high up the call stack as you can. i.e. On button click.
  • Don't pass SPDataContext everywhere, use SPDataContext.GetCurrent(). The data context returned from GetCurrent does not need to be disposed.
  • Dispose of SPDataContext. Use it in a using block.
  • Name lists plural and content types sigularly. ie Name a list "Projects" and the content type "Project".
  • Don't use SharePoint methods, use the SPOrm equivalient. This will help with unit testing because SPOrm was designed to be mockable.

Last edited Sep 9, 2009 at 12:06 AM by joegtp, version 2


No comments yet.