Excellent series of resources on SharePoint Design Models:
A Static State: SharePoint 2010 Architecture and Design Models.
Excellent series of resources on SharePoint Design Models:
A Static State: SharePoint 2010 Architecture and Design Models.
Application Lifecycle Management (ALM) is the coordination of all aspects of software engineering — including the formulation and communication of business and technical requirements, code design and architecture, project tracking, change management, coding, testing, debugging, and release management — by using tools that facilitate and track collaboration among and within work teams.
SharePoint 2010 offers significant enhancements to in the ALM space through the use of feature versioning, a more robust feature schema, the ability to push down upgrades to existing feature instances and
Visual Studio 2010 natively understands SharePoint development and thus provides a significantly improved toolset for the development of applications for SharePoint. Projects are compiled into a Windows SharePoint Package (WSP) file that can then be deployed in a repeatable manner through the various environments. Many aspects of the creation of these features is handled by Visual Studio thereby increasing the productivity of the developers.
SharePoint applications and customizations are typically built and deployed using the Feature Framework. This enables repeatable deployments from one environment to another and allows modules of functionality to be deployed to different scopes within SharePoint (provisioning).
Artifacts in SharePoint are typically divided into 2 main categories
Pros & Cons of Declarative Provisioning with XML
|
Advantages |
Disadvantages |
|
Required for some artifacts (for example, site definition, list template, delegate control, custom action, custom field control) |
Not possible to debug the provisioning process Little support for upgrade scenarios (for example, some changes to a content type that is in use cannot be done with XML) |
|
Provisioning instructions are not in compiled code, so potentially easier to update |
Difficult to control provisioning sequence in some areas |
|
Arguably steeper learning curve than API |
A significant improvement in the SharePoint 2010 ALM is support for feature versioning. This allows for much cleaner upgrade process than WSS 3.0 offered. In order to support this new Feature schema elements have been defined.
Microsoft has added some new XML to the Features framework to support Feature upgrade. When a new version of a Feature is created, this may involve:
Feature upgrade is useful in the following scenarios:
The following table details the schema enhancements along with a description
|
XML Element |
Description |
|
UpgradeActions |
Parent element for defining provisioning upgrade steps. All subsequent XML elements in this table are children of UpgradeActions. |
|
VersionRange |
Defines the range of existing Feature versions to upgrade with the steps defined within this element. This has BeginVersion and EndVersion attributes. Enables a Feature to be repeatedly upgraded through its lifecycle. |
|
ApplyElementManifests |
Allows new Feature elements to be added to an existing Feature. Items declared in the referenced element manifest files will be provisioned on upgrade. |
|
AddContentTypeField |
Provides a declarative shortcut for the common task of adding a field to an existing content type. |
|
CustomUpgradeAction |
Provides a means of allowing custom code to execute during Feature upgrade. This allows the developer to handle advanced scenarios that cannot be dealt with by declarative XML alone. |
A sample of this new schema can be found below:
<?xml
version=”1.0″
encoding=”utf-8″ ?>
<Feature
xmlns=”http://schemas.microsoft.com/sharepoint/”
Version=”1.0.0.0″>
<UpgradeActions>
<VersionRange
BeginVersion=”0.0.0.0″
EndVersion=”0.9.9.9″>
<ApplyElementManifests>
<ElementManifest
Location=”SomeFunctionality_Iteration2\Elements.xml”
/>
</ApplyElementManifests>
<AddContentTypeField
ContentTypeId=”0x010073f25e2ac37846bb8e884770fb7307c7″
FieldId=”{536DC46C-DC26-4DB0-A97C-7C21E4362A85}”
PushDown=”TRUE”/>
<AddContentTypeField
ContentTypeId=”0x010073f25e2ac37846bb8e884770fb7307c7″
FieldId=”{4E7A6719-011A-47EA-B983-A4941D688CA6}”
PushDown=”TRUE”/>
<CustomUpgradeAction
Name=”UpdateSomething”>
<Parameters>
<Parameter
Name=”PassSomeValue”>This is a string</Parameter>
</Parameters>
</CustomUpgradeAction>
</VersionRange>
</Feature>
The following code will handle the FeatureUpgrading event and the handling of parameters defined in the Feature.xml file above.
public
override
void FeatureUpgrading(SPFeatureReceiverProperties properties, string upgradeActionName, System.Collections.Generic.IDictionary<string, string> parameters)
{
SPWeb parentWeb = (SPWeb)properties.Feature.Parent;
switch (upgradeActionName)
{
case
"UpdateSomething":
string someValue = parameters["PassSomeValue"];
// do some stuff..
break;
default:
break;
}
}
This section describes at a high level how you can put these feature-versioning and upgrading capabilities to work. When you create a new version of a feature that is already deployed on a large SharePoint 2010 farm, you must consider two different scenarios: what happens when the feature is activated on a new site and what happens on sites where the feature already exists. When you add new content to the feature, you must first update all of the existing definitions and include instructions for upgrading the feature where it is already deployed.
For example, perhaps you have developed a content type to which you must add a custom site column named City. You do this in the following way:
When you deploy the new version of the feature to existing sites and upgrade it, the upgrade actions are applied to sites one by one. If you have defined custom upgrade actions, the FeatureUpgrading method will be called as many times as there are instances of the feature activated in your site collection or farm. (Juvonen, 2011)
Consider the following scenario as well:


Features are upgraded in the following order: first at the server farm level, next at the Web application level, then site collection, and finally, at specific Web sites. At the Web site level, Feature instances are upgraded starting with root Web sites and progressing downward through the hierarchy of child Web sites. Features are upgraded based on the order of dependency, that is, dependent Features are upgraded after the Features that they depend upon.
Assembly Versioning Number Standards
|
Adding some internal code (for example, logging) to a class, with no change to signature |
1.0.0.1 |
|
Adding a new member to an existing class |
1.0.1.0 |
|
Adding a new class to a namespace |
1.1.0.0 |
|
Removing a class or public/protected class member |
2.0.0.0 |
Feature Versioning Standards
|
Changing a display name of the Feature or an artifact |
1.0.0.1 |
|
Adding a new artifact to an existing Feature |
1.0.1.0 |
|
Modifying a template artifact (for example, a list definition) |
1.1.0.0 |
|
Removing an artifact from a Feature, or any other major change (for example, one that would cause a dependent Feature to break) |
2.0.0.0 |
Some further guidelines on Feature Versioning are below:
The standard for managing the feature upgrade process will be to use the Open Source SharePoint Feature Upgrade kit available at http://spfeatureupgrade.codeplex.com/. This extends Central Administration to provide this functionality as well as includes PowerShell cmdlets to facilitate the process. More explanation is provided here: http://www.sharepointnutsandbolts.com/search?q=cmdlet
Do not instantiate an SPWeb, SPSite, SPList, or SPListItem object within an event receiver. Event receivers that instantiate these objects instead of using the instances passed via the event properties can cause the following issues:
This section is not intended to be a comprehensive listing of TGT’s software development best practices but rather an outline of SharePoint specific code design standards related to the SharePoint ALM
To provide more flexibility for your code, you should not place your upgrade code directly inside the FeatureUpgrading event receiver. Instead, put the code in some centralized location and refer to it inside the event receiver
By placing your upgrade code inside a centralized utility class, you increase both the reusability and the testability of your code, because you can perform the same actions in multiple locations. You should also try to design your custom upgrade actions as generically as possible, using parameters to make them applicable to specific upgrade scenarios. (Juvonen, 2011)
When a feature has previously been deployed to a non-development environment (SIT, QA, PROD) it must be versioned and upgraded appropriately. The following steps must be followed.
Juvonen, V. (2011, February). Application Lifecycle Management in SharePoint 2010. Retrieved from MSDN: http://msdn.microsoft.com/en-us/library/gg604045.aspx
O’Brien, C. (2011). Real World SharePoint 2010. Indianapolis, Indiana: Wiley Publishing.
O’Brien, C. (n.d.). Feature Upgrade Fundamentals. Retrieved from Fun and Games with the Nuts and Bolts of SharePoint: http://www.sharepointnutsandbolts.com/2010/06/feature-upgrade-part-1-fundamentals.html
it's there…use it.