C# Class GSoft.Dynamite.ServiceLocator.SharePointServiceLocator

Interface for the retrieval of Autofac dependency injection lifetime scopes, with SharePoint-specific semantics. Less flexible than , it is meant to encourage container usage that depends as little as possible on direct injection through the service locator pattern.
Inheritance: ISharePointServiceLocator
Show file Open project: GSoft-SharePoint/Dynamite-2010

Private Properties

Property Type Description

Public Methods

Method Description
BeginLifetimeScope ( ) : ILifetimeScope

Creates a new child lifetime scope - a child to the most-nested currently available lifetime scope. In an HTTP-request context, will return a child scope to the shared per-request scope (allowing you to inject InstancePerSite, InstancePerWeb and InstancePerRequest-registered objects). Be sure to enable Dynamite's feature HttpModule feature: "GSoft.Dynamite.SP_Web Config Modifications" so that InstancePerRequest-scoped objects get properly disposed at the end of every HttpRequest. Outside an HTTP-request context, will return the a child of the root application container itself (preventing you from injecting InstancePerSite, InstancePerWeb or InstancePerRequest objects). Please dispose this lifetime scope when done (E.G. call this method from a using block).

BeginLifetimeScope ( SPFarm farm ) : ILifetimeScope

Creates a new child lifetime scope under the root application container (objects registered as InstancePerSite, InstancePerWeb or InstancePerRequest will be inaccessible). Please dispose this lifetime scope when done (E.G. call this method from a using block).

BeginLifetimeScope ( SPFeature feature ) : ILifetimeScope

Creates a new child lifetime scope that is as nested as possible, depending on the scope of the specified feature. In a SPSite or SPWeb-scoped feature context, will return a web-specific lifetime scope (allowing you to inject InstancePerSite and InstancePerWeb objects - InstancePerRequest scoped objects will be inaccessible). In a SPFarm or SPWebApplication feature context, will return a child container of the root application container (preventing you from injecting InstancePerSite, InstancePerWeb or InstancePerRequest objects). Please dispose this lifetime scope when done (E.G. call this method from a using block).

BeginLifetimeScope ( SPSite site ) : ILifetimeScope

Creates a new child lifetime scope under the scope of the specified site collection (allowing you to inject InstancePerSite objects - InstancePerWeb and InstancePerRequest scoped objects will be inaccessible). Please dispose this lifetime scope when done (E.G. call this method from a using block).

BeginLifetimeScope ( SPWeb web ) : ILifetimeScope

Creates a new child lifetime scope under the scope of the specified web (allowing you to inject InstancePerSite and InstancePerWeb objects - InstancePerRequest scoped objects will be inaccessible). Please dispose this lifetime scope when done (E.G. call this method from a using block).

BeginLifetimeScope ( SPWebApplication webApplication ) : ILifetimeScope

Creates a new child lifetime scope under the root application container (objects registered as InstancePerSite, InstancePerWeb or InstancePerRequest will be inaccessible). Please dispose this lifetime scope when done (E.G. call this method from a using block).

SharePointServiceLocator ( string appRootNamespace ) : System

Initializes a new instance of the SharePointServiceLocator class.

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

Initializes a new instance of the SharePointServiceLocator class.

Method Details

BeginLifetimeScope() public method

Creates a new child lifetime scope - a child to the most-nested currently available lifetime scope. In an HTTP-request context, will return a child scope to the shared per-request scope (allowing you to inject InstancePerSite, InstancePerWeb and InstancePerRequest-registered objects). Be sure to enable Dynamite's feature HttpModule feature: "GSoft.Dynamite.SP_Web Config Modifications" so that InstancePerRequest-scoped objects get properly disposed at the end of every HttpRequest. Outside an HTTP-request context, will return the a child of the root application container itself (preventing you from injecting InstancePerSite, InstancePerWeb or InstancePerRequest objects). Please dispose this lifetime scope when done (E.G. call this method from a using block).
public BeginLifetimeScope ( ) : ILifetimeScope
return ILifetimeScope

BeginLifetimeScope() public method

Creates a new child lifetime scope under the root application container (objects registered as InstancePerSite, InstancePerWeb or InstancePerRequest will be inaccessible). Please dispose this lifetime scope when done (E.G. call this method from a using block).
public BeginLifetimeScope ( SPFarm farm ) : ILifetimeScope
farm SPFarm
return ILifetimeScope

BeginLifetimeScope() public method

Creates a new child lifetime scope that is as nested as possible, depending on the scope of the specified feature. In a SPSite or SPWeb-scoped feature context, will return a web-specific lifetime scope (allowing you to inject InstancePerSite and InstancePerWeb objects - InstancePerRequest scoped objects will be inaccessible). In a SPFarm or SPWebApplication feature context, will return a child container of the root application container (preventing you from injecting InstancePerSite, InstancePerWeb or InstancePerRequest objects). Please dispose this lifetime scope when done (E.G. call this method from a using block).
public BeginLifetimeScope ( SPFeature feature ) : ILifetimeScope
feature SPFeature The current feature context from which we are requesting a child lifetime scope
return ILifetimeScope

BeginLifetimeScope() public method

Creates a new child lifetime scope under the scope of the specified site collection (allowing you to inject InstancePerSite objects - InstancePerWeb and InstancePerRequest scoped objects will be inaccessible). Please dispose this lifetime scope when done (E.G. call this method from a using block).
public BeginLifetimeScope ( SPSite site ) : ILifetimeScope
site SPSite The current site collection from which we are requesting a child lifetime scope
return ILifetimeScope

BeginLifetimeScope() public method

Creates a new child lifetime scope under the scope of the specified web (allowing you to inject InstancePerSite and InstancePerWeb objects - InstancePerRequest scoped objects will be inaccessible). Please dispose this lifetime scope when done (E.G. call this method from a using block).
public BeginLifetimeScope ( SPWeb web ) : ILifetimeScope
web SPWeb The current web from which we are requesting a child lifetime scope
return ILifetimeScope

BeginLifetimeScope() public method

Creates a new child lifetime scope under the root application container (objects registered as InstancePerSite, InstancePerWeb or InstancePerRequest will be inaccessible). Please dispose this lifetime scope when done (E.G. call this method from a using block).
public BeginLifetimeScope ( SPWebApplication webApplication ) : ILifetimeScope
webApplication SPWebApplication The current context's web application
return ILifetimeScope

SharePointServiceLocator() public method

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

SharePointServiceLocator() public method

Initializes a new instance of the SharePointServiceLocator class.
public SharePointServiceLocator ( 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