C# Class GSoft.Dynamite.ServiceLocator.SharePointContainerProvider

A SharePoint-specific Autofac container provider implementation, which is meant to provide your application with a Container that automatically scans the GAC (using the appRootNamespace or assemblyFileNameMatcher as assembly filename filter) and loads the matched assemblies' registration modules.
In your application, create and maintain your own SharePointContainerProvider instance to act as Service Locator for your entire application. Avoid using the same appRootNamespace with two different provider instances, as the same AppDomain-wide inner container instance will be reused in that case (details in AppDomainContainers ).
Inheritance: NamespaceFilteredContainerProvider, ISharePointContainerProvider
Mostrar archivo Open project: GSoft-SharePoint/Dynamite-2010

Public Methods

Method Description
EnsureSiteScope ( SPSite site ) : ILifetimeScope

Either creates a new lifetime scope from the specified site or returns the existing one. Don't dispose this scope instance, as it could be reused by others. Allows for the usage of InstancePerSite even when outside of a typical HTTP request context (for example, use EnsureSiteScope from a FeatureActivated even receiver run from Powershell.exe to reuse objects across many event receivers triggered by the same process). In typical HTTP request context, use CurrentSite property instead.

EnsureWebScope ( SPWeb web ) : ILifetimeScope

Either creates a new lifetime scope from the specified web or returns the existing one. Don't dispose this scope instance, as it could be reused by others. Allows for the usage of InstancePerWeb even when outside of a typical http request context (for example, use EnsureSiteScope from a FeatureActivated even receiver run from Powershell.exe to reuse objects across many event receivers triggered by the same process). In typical HTTP request context, use CurrentWeb property instead.

SharePointContainerProvider ( string appRootNamespace ) : System

Initializes a new instance of the SharePointContainerProvider class.

SharePointContainerProvider ( string appRootNamespace, bool>.Func assemblyFileNameMatcher ) : System

Initializes a new instance of the SharePointContainerProvider class.

Method Details

EnsureSiteScope() public method

Either creates a new lifetime scope from the specified site or returns the existing one. Don't dispose this scope instance, as it could be reused by others. Allows for the usage of InstancePerSite even when outside of a typical HTTP request context (for example, use EnsureSiteScope from a FeatureActivated even receiver run from Powershell.exe to reuse objects across many event receivers triggered by the same process). In typical HTTP request context, use CurrentSite property instead.
public EnsureSiteScope ( SPSite site ) : ILifetimeScope
site SPSite The current site to use in retreiving or creating the scope
return ILifetimeScope

EnsureWebScope() public method

Either creates a new lifetime scope from the specified web or returns the existing one. Don't dispose this scope instance, as it could be reused by others. Allows for the usage of InstancePerWeb even when outside of a typical http request context (for example, use EnsureSiteScope from a FeatureActivated even receiver run from Powershell.exe to reuse objects across many event receivers triggered by the same process). In typical HTTP request context, use CurrentWeb property instead.
public EnsureWebScope ( SPWeb web ) : ILifetimeScope
web SPWeb The current web to use in retreiving or creating the scope
return ILifetimeScope

SharePointContainerProvider() public method

Initializes a new instance of the SharePointContainerProvider class.
public SharePointContainerProvider ( string appRootNamespace ) : System
appRootNamespace string /// The app root namespace. ///
return System

SharePointContainerProvider() public method

Initializes a new instance of the SharePointContainerProvider class.
public SharePointContainerProvider ( string appRootNamespace, bool>.Func assemblyFileNameMatcher ) : System
appRootNamespace string /// The app root namespace. ///
assemblyFileNameMatcher bool>.Func /// The assembly file name matcher (will be used instead of the appRootNamespace to /// match assembly names in the GAC). The appRootNamespace still acts as the provided /// container's unique key among all the other containers that live in the AppDomain. ///
return System