c# - Overriding lifecycles on an application specific basis using Simple Injector -
I am trying to apply the combination of many essential applications and several class libraries for my solution. I am using simple injectors as the framework of my choice.
To have many applications, many combination roots are required, however, I do not want to register duplicate container in every combination route. I am considering using the mentioned approach, but I am running into problems.
How can I override the lifestyles for registration on an application basis? Specifically, I want to override certain container registrations using a transient life cycle for the same registration in my other applications while one "per web API request life cycle" in my Mesh API application.
 The moving structure is to pass a scaled lifestyle on the centralized part of the root By using the   In your end application, you can call it as:    Although this works only when the  base class is by using   Passing  
 public static class BusinessLayerBootstrapper {public static void bootstrap (container container, ScopedLifestyle scopedLifestyle) {container.Register & lt; IUnitOfWork, Myadbandtex & gt; (Scap Lifestyle); // etc ...}}    
 public class global: application {secure Override Application_Start () {Var Container = New Container (); Container.registerMvcControllers (); BusinessLayerBootstrapper Bootstrap (Container, New WebRest Lifestyle ()); Dependent Resellers. SetsSolar (new simple injection corrosionarosolar (container)); }}   , there is some functionality like this class that you may be interested in , Lacks  RegisterForDisposal ,  GetCurrentScope  and  WhenScopeEnds .   ScopedLifestyle  Even when you create hybrid lifestyle, there is a  Lifestyle.CreateHybrid  overload that works from there  ScopedLifestyle  takes you to a new  return is ScopedLifestyle  example:   
 ScopedLifestyle mixedScopeLifestyle = Lifestyle.CreateHybrid ((=) HttpContext .Current = Null, New WebRequestLifestyle (), New LifetimeScopeLifestyle ()!);    
 
  
Comments
Post a Comment