Question

Is it possible to get an instance of a service without having a WorkItem context? I have a some classes that need to access some services, and i'm wondering if it's possible to get those services without explicitly injecting those services in the class.

Was it helpful?

Solution

As all the services are registered in WorkItem or rootWorkItem context its not possible according to the design rules of CAB/SCSF.

Please elaborate why you cannot register the service in WorkItem and get it from there. CAB/SCSF has proposed the best practices to manage an enterprise application, its upto us how much we benefit from it.

But if its really necessary you can have a static class (which can act as service implemented in singleton way) in Infrastructure.Library and refer this assembly in your Business or Functional module to get it.

Its a bad hack but technically doable.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top