{"action":"created","issue":{"url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/152","labels_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/152/labels{/name}","comments_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/152/comments","events_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/152/events","html_url":"https://github.com/simpleinjector/SimpleInjector/issues/152","id":118617469,"number":152,"title":"Set Lifestyle of the resulting collection using RegisterCollection?","user":{"login":"apetkovic","id":1282594,"avatar_url":"https://avatars.githubusercontent.com/u/1282594?v=3","gravatar_id":"","url":"https://api.github.com/users/apetkovic","html_url":"https://github.com/apetkovic","followers_url":"https://api.github.com/users/apetkovic/followers","following_url":"https://api.github.com/users/apetkovic/following{/other_user}","gists_url":"https://api.github.com/users/apetkovic/gists{/gist_id}","starred_url":"https://api.github.com/users/apetkovic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apetkovic/subscriptions","organizations_url":"https://api.github.com/users/apetkovic/orgs","repos_url":"https://api.github.com/users/apetkovic/repos","events_url":"https://api.github.com/users/apetkovic/events{/privacy}","received_events_url":"https://api.github.com/users/apetkovic/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/simpleinjector/SimpleInjector/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-24T14:15:18Z","updated_at":"2015-11-24T15:51:51Z","closed_at":null,"body":"I register most of my dependencies using the `WebRequestLifestyle` in an MVC application. Some of those dependencies require a collection to be injected into them and I register those collections with `RegisterCollection`. However, when I run my application I get an exception that\r\n\r\n> A lifestyle mismatch is encountered. UserManager (Web Request) depends on `IPushProvider[]` (Transient).\r\n\r\nIt appears the collection itself is transient. I've set my container options of `DefaultScopedLifestyle = WebRequestLifestyle` and `LifestyleSelectionBehavior = ScopedLifestyleSelectionBehavior` but that didn't help. How can I set the lifestyle of the collection itself, not just types within the collection?"},"comment":{"url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/comments/159310842","html_url":"https://github.com/simpleinjector/SimpleInjector/issues/152#issuecomment-159310842","issue_url":"https://api.github.com/repos/simpleinjector/SimpleInjector/issues/152","id":159310842,"user":{"login":"apetkovic","id":1282594,"avatar_url":"https://avatars.githubusercontent.com/u/1282594?v=3","gravatar_id":"","url":"https://api.github.com/users/apetkovic","html_url":"https://github.com/apetkovic","followers_url":"https://api.github.com/users/apetkovic/followers","following_url":"https://api.github.com/users/apetkovic/following{/other_user}","gists_url":"https://api.github.com/users/apetkovic/gists{/gist_id}","starred_url":"https://api.github.com/users/apetkovic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apetkovic/subscriptions","organizations_url":"https://api.github.com/users/apetkovic/orgs","repos_url":"https://api.github.com/users/apetkovic/repos","events_url":"https://api.github.com/users/apetkovic/events{/privacy}","received_events_url":"https://api.github.com/users/apetkovic/received_events","type":"User","site_admin":false},"created_at":"2015-11-24T15:51:51Z","updated_at":"2015-11-24T15:51:51Z","body":"Wow, thanks for the super fast reply! I've changed my business logic layer to use IEnumerable<T> in the constructors instead of arrays and that certainly worked. Thanks! This is an unrelated question, and perhaps I should post it in a new thread... I've used OnActivation and OnDeactivation methods in Ninject to execute logic when an instance is first resolved. I checked the documentation and couldn't find anything like that for Simple Injector. Is there a way to extend Simple Injector and create this behavior?"}}