hendryluk / cormo

.NET Application Framework based on Spring and Java EE CDI
MIT License
5 stars 4 forks source link

Would u consider implementing CommonServiceLocator? #4

Closed worldspawn closed 9 years ago

worldspawn commented 9 years ago

So this could wired up with something like mediatr?

hendryluk commented 9 years ago

Yep i cant see why not. I'd do that, especially if its only to be used for mediatr. But people shouldnt be using service locator directly though because it messes up with contexts and injection point (or the lack of them)

hendryluk commented 9 years ago

Btw i may not be familiar with the full feature of mediatr but i think it could be redundant since cdi already has component-discovery and resolution, decorator, and event handling built-in. What else can we gain from mediatr?

hendryluk commented 9 years ago

Btw by "messed up with context" what i meant is that when u request things manually from common-service-locator api (i.e not within mediatr), cormo won't be able to keep track of it, i.e unmanaged. It also cant tell who's asking. So certain things may not behave the same way (eg lifecycles). Should be fine in most cases but should only be used in dire circumstances

hendryluk commented 9 years ago

@worldspawn This has now been implemented: https://github.com/hendryluk/cormo/blob/master/src/Cormo.CommonServiceLocator/CormoServiceLocator.cs

Up on nuget: http://www.nuget.org/packages/Cormo.CommonServiceLocator/. Would that automatically work with Mediatr? Ideally so or else we can make the module wire that up automatically