Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IEnumerable Transitioning #10

Open
smudge202 opened this issue Mar 5, 2015 · 5 comments
Open

IEnumerable Transitioning #10

smudge202 opened this issue Mar 5, 2015 · 5 comments
Labels
Milestone

Comments

@smudge202
Copy link
Collaborator

This behaviour needs further discussion @mattridgway / @AdamWilks et al.

In essence, several DI containers provide functionality allowing consumers to have an IEnumerable be injected. The expected behaviour is for the container to find all registered implementations assignable from IService.

I believe @mattridgway would like to introduce an observable variant which would allow consumers to subscribe for notifications of new services (assignable from IService) being registered.

Personally, I would like to see an extension that the Host projects can use to mark a service as Transitional (possibly separate from existing extensions), which would allow our IEnumerable implementation to append new services so that the next enumeration would yield both original and new services.

@smudge202
Copy link
Collaborator Author

/CC @herecydev

@herecydev
Copy link
Contributor

I'm in favour of how tommys would work. That would be my expected behaviour of registering new services. I.e. add not replace.

@smudge202
Copy link
Collaborator Author

Regarding my personal preference on implementation, a potential downside would be if the consumer calls "ToList", the behaviour I described would obviously be no longer available.

Perhaps there is merit in defining a custom INamedEnumerable? That way we could add an overriding "ToList" extension that continues the described behaviour and does not allow Add/Update operations? (Sounds horrid, but bad idea > no idea).

@herecydev
Copy link
Contributor

I think if someone was doing this they should be informed enough to know they are caching the results and ignoring any potential amendments. I actually dont see this as a huge negative. Just something to bear in mind

@smudge202
Copy link
Collaborator Author

@herecydev "It's not a bug, it's a feature"?

@smudge202 smudge202 added this to the later milestone Mar 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants