Last week I reviewed some code that contains memory leaks and I noticed that they fetched some credentials from the Secure Store Service in a way that just didn't seem right to me. If you look at this code sample on MSDN you should be able to see what I mean.
Triggered by a blog post of Scott Hanselman I was wondering if I could create a generic extension method to asynchronously retrieve objects from a DataContext. And well I could. I ended up with two classes.
Sometimes I perform a code review and at first glance everything looks fine, but - while I’m digging my way in - I slowly start to encounter some ‘hidden features’. This post is all about the dangers of lazy loading and not following some of the design guidelines.
In part one I talked about strongly typed access to SharePoint list items and we did set a base for how to retrieve values in a more strongly typed fashion. In part two I'll extend this example and show you how to retrieve wrapped items from a SharePoint list.
It's great to see how flexible SharePoint 2007 actually is. You can create lists that can contain all sorts of data. Add columns, create data types, create content types etc. But great flexibility has a price. All to often I lay my eyes on code that's not readeable, manageable or strongly typed. Which leaves a lot of room for errors. In this post I'll drop some of my ideas on how to create and access lists in a SharePoint 2007 solution. Which will leave you with strongly typed access to your content types.
A lot of the times when developers need some sort of enumeration they tend to create a generic list by default. Even if they realy need to iterate that list only once. Some good examples can be found in solutions offered to this code puzzle at less than dot(which is a great newcomer).
[note: This is a repost from my previous blogspace. My previous blogspace has been out of air for a while because of technical issues and a lot of developers were never able to read the articles.]