/// <summary>
 /// One component instance per HttpApplication instance.
 /// </summary>
 /// <typeparam name="S"></typeparam>
 /// <param name="group"></param>
 /// <returns></returns>
 public static ComponentRegistration <S> PerHttpApplication <S>(this LifestyleGroup <S> @group) where S : class
 {
     return(@group.Scoped <HttpApplicationScopeAccessor>());
 }
 /// <summary>
 /// One component instance per web request, or if HttpContext is not available, one per thread.
 /// </summary>
 /// <typeparam name="S"></typeparam>
 /// <param name="group"></param>
 /// <returns></returns>
 public static ComponentRegistration <S> HybridPerWebRequestPerThread <S>(this LifestyleGroup <S> @group) where S : class
 {
     return(@group.Scoped <HybridPerWebRequestPerThreadScopeAccessor>());
 }
 /// <summary>
 /// Hybrid lifestyle - per web request or per scope.
 /// </summary>
 public static ComponentRegistration <TService> HybridPerWebRequestScope <TService>(this LifestyleGroup <TService> lifestyleGroup)
     where TService : class
 {
     return(lifestyleGroup.Scoped <HybridPerWebRequestScopeScopeAccessor>());
 }
Пример #4
0
 /// <summary>
 /// Singleton instance with .NET Core semantics
 /// </summary>
 /// <typeparam name="TService"></typeparam>
 public static ComponentRegistration <TService> NetStatic <TService>(this LifestyleGroup <TService> lifestyle) where TService : class
 {
     return(lifestyle
            .Scoped <ExtensionContainerRootScopeAccessor>());
 }
 /// <summary>
 /// Singleton instance with .NET Core semantics
 /// </summary>
 /// <typeparam name="TService"></typeparam>
 public static ComponentRegistration <TService> NetCoreStatic <TService>(this LifestyleGroup <TService> lifestyle) where TService : class
 {
     return(lifestyle
            .Scoped <NetCoreRootScopeAccessor>());
 }
Пример #6
0
 /// <summary>
 /// One component instance per web request, or if HttpContext is not available, scoped.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="group"></param>
 /// <returns></returns>
 public static ComponentRegistration <T> HybridPerWebRequestScoped <T>(this LifestyleGroup <T> group) where T : class
 {
     return(group.Scoped <HybridPerWebRequestScopedScopeAccessor>());
 }
 /// <summary>
 /// One component instance per web request, or if HttpContext is not available, transient.
 /// </summary>
 /// <typeparam name="S"></typeparam>
 /// <param name="group"></param>
 /// <returns></returns>
 public static ComponentRegistration <S> HybridPerWebRequestTransient <S>(this LifestyleGroup <S> @group)
     where S : class =>
 @group.Scoped <HybridPerWebRequestTransientScopeAccessor>();
 /// <summary>
 /// One component instance per web session.
 /// Warning: because the session end event request only works InProc, components can't be reliably disposed. Burden is also affected.
 /// </summary>
 /// <typeparam name="S"></typeparam>
 /// <param name="group"></param>
 /// <returns></returns>
 public static ComponentRegistration <S> PerWebSession <S>(this LifestyleGroup <S> @group)
     where S : class =>
 @group.Scoped <WebSessionScopeAccessor>();
Пример #9
0
 /// <summary>
 /// Currently just an alias for Scoped since that is how we implement per message lifestyle in nservicebus.
 /// </summary>
 public static ComponentRegistration <TComponent> PerNserviceBusMessage <TComponent>(this LifestyleGroup <TComponent> lifestyleGroup) where TComponent : class
 {
     return(lifestyleGroup.Scoped());
 }