Execution Models in SharePoint 2010
SharePoint solution development encompasses many different types of applications. These applications are deployed to different locations, are loaded by different processes, and are subject to different execution conditions and constraints. The topics in this section are designed to give you an understanding of your execution options when you develop solutions for SharePoint 2010.
When you plan how you want your code to execute, the factors driving your decisions fall into two broad areas:
- Execution environment. This is the security and processing boundary that contains your running code. If you have worked with earlier versions of SharePoint, you are familiar with the full trust execution model and the bin/code access security (commonly known as bin/CAS) execution model. SharePoint 2010 provides new options in this area with the introduction of the restricted, site collection-scoped sandbox execution model.
- Execution logic. This is the means by which your code actually gets invoked. For example, execution logic defines whether your code runs synchronously or asynchronously, whether it is invoked by a timer job or a workflow or a Web page, and whether it impersonates the current user or runs using the identity of the process account.
The following illustration shows some of the options available to you in each of these areas.
Execution considerations for SharePoint 2010 applications
Execution environment and execution logic are heavily interrelated. Some of the choices you make under execution logic prescribe the use of a particular execution environment model. For example, if you develop a timer job, you must deploy it as a full-trust application. Likewise, if you want to run your code with elevated permissions, you cannot use a sandboxed application. Some execution logic patterns can also be used to bridge the divide between different execution environments, as described later in this section.
This guidance is largely structured around the capabilities and constraints of each execution environment model. However, in each topic, the guidance is informed by the options and constraints imposed by the various different approaches to execution logic in SharePoint applications.
This section includes the following topics that will help you to understand execution in SharePoint 2010:
- Understanding SharePoint Execution Models. This section introduces the different execution and deployment models that are available to you when you develop solutions for SharePoint 2010. It provides an overview of each execution model, explains the benefits and limitations of each approach, and describes when it may be appropriate to use a particular model.
- Farm Solutions. This topic provides a detailed insight into how farm solution code is executed by the SharePoint environment. It describes what you can do with farm solutions, and it identifies the core issues that you should consider when you write farm solution code.
- Sandboxed Solutions. This topic provides a similar insight into the sandbox execution environment. In addition, it aims to give you a detailed understanding of how sandboxed solutions are monitored and managed by the SharePoint environment.
- Hybrid Approaches. This topic provides a detailed review of execution models that enable you to combine sandboxed solutions with full trust functionality. It explains how each of these execution models works, and it identifies issues specific to the deployment and execution of hybrid solutions.
This documentation uses the term "execution model" to describe the different approaches that are available to you in the execution environment area.