Defines a lifestyle that caches instances for the lifetime of a WCF service class. WCF allows service classes to be (both implicitly and explicitly) configured to have a lifetime of PerCall, PerSession or Single using the InstanceContextMode enumeration. The lifetime of WCF service classes is controlled by WCF and this lifestyle allows registrations to be scoped according to the containing WCF service class.
Assembly: SimpleInjector.Integration.Wcf (in SimpleInjector.Integration.Wcf.dll) Version: 4.0.0
public class WcfOperationLifestyle : ScopedLifestyle
Public Class WcfOperationLifestyle Inherits ScopedLifestyle
Thetype exposes the following members.
Initializes a new instance of the IDisposable.class. The instance will ensure that created and cached instance will be disposed after the execution of the web request ended and when the created object implements
|WcfOperationLifestyle(Boolean)|| Obsolete. |
Initializes a new instance of theclass.
Creates a delegate that upon invocation return the current Scope for this lifestyle and the given container, or null when the delegate is executed outside the context of such scope.
Returns the current Scope for this lifestyle and the given container, or null when this method is executed outside the context of a scope.
|WhenWcfOperationEnds|| Obsolete. |
Allows registering an action delegate that will be called when the current WCF operation ends, but before the scope disposes any instances.
var container = new Container(); container.Options.DefaultScopedLifestyle = new WcfOperationLifestyle(); container.Register<IUnitOfWork, EntityFrameworkUnitOfWork>(Lifestyle.Scoped);