Microsoft patterns & best practices for SharePoint 2010
I found this SharePoint 2010 “framework” on codeplex which has been created by several MVP’s. It contains several patterns & best practices which help you best take advantage of the new capability’s of SharePoint 2010.
The website is http://spg.codeplex.com/. Here you can find a large pdf e-book which explains all of the functionality the framework provides + some hands on labs and examples how to implement this into your projects.
At first it looks like a very high level framework but I think it will definitely give some added value to your SharePoint 2010 projects!
An example for this is the application setting manager:
The Application Setting Manager is a set of utility classes that you can use to store and retrieve configuration settings for your SharePoint applications. The Application Setting Manager provides a uniform, type-safe approach for managing configuration settings at the following levels of the SharePoint hierarchy.
Farm (SPFarm class)
Web application (SPWebApplication class)
Site collection (SPSite class)
Site (SPWeb class)
You can use the Application Setting Manager to store simple types, such as integers or strings, as well as more complex types that can be serialized to XML. The Application Setting Manager manages the serialization and deserialization of data types to and from XML.
The Application Setting Manager provides a hierarchical model for the storage and retrieval of configuration settings. This enables you to create an application setting at a broad scope (such as the farm level) and override that setting at a narrower scope (such as the site level). When you retrieve a setting, using a key string, the Application Setting Manager will first look for that key at the site (SPWeb) level of the current execution context.
If the configuration key is not found, the Application Setting Manager will look for the configuration setting at progressively broader scope, up to and including the farm level. For example, you could use the following code to locate a configuration setting of type DateTime, without knowing the level in the SharePoint hierarchy at which the setting is stored.
IServiceLocator serviceLocator = SharePointServiceLocator.GetCurrent();
var config = serviceLocator.GetInstance();
timeApproved = config.GetByKey("approvedTime");
As illustrated by the code example, you are encouraged to use the SharePoint Service Locator to retrieve and instantiate instances of the interfaces provided by the Application Setting Manager.