{"action":"opened","issue":{"url":"https://api.github.com/repos/aspnet/DependencyInjection/issues/246","labels_url":"https://api.github.com/repos/aspnet/DependencyInjection/issues/246/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/DependencyInjection/issues/246/comments","events_url":"https://api.github.com/repos/aspnet/DependencyInjection/issues/246/events","html_url":"https://github.com/aspnet/DependencyInjection/issues/246","id":85807546,"number":246,"title":"Add support for child containers","user":{"login":"glen-84","id":261509,"avatar_url":"https://avatars.githubusercontent.com/u/261509?v=3","gravatar_id":"","url":"https://api.github.com/users/glen-84","html_url":"https://github.com/glen-84","followers_url":"https://api.github.com/users/glen-84/followers","following_url":"https://api.github.com/users/glen-84/following{/other_user}","gists_url":"https://api.github.com/users/glen-84/gists{/gist_id}","starred_url":"https://api.github.com/users/glen-84/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glen-84/subscriptions","organizations_url":"https://api.github.com/users/glen-84/orgs","repos_url":"https://api.github.com/users/glen-84/repos","events_url":"https://api.github.com/users/glen-84/events{/privacy}","received_events_url":"https://api.github.com/users/glen-84/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-06T19:58:40Z","updated_at":"2015-06-06T19:58:40Z","closed_at":null,"body":"Use case: You add a \"module\" (separate assembly) to your web application which contains controllers, views, etc. The MVC parts make use of an `IStringLocalizer` implementation that loads strings from a JSON file (for example). When you \"register\" the module, it adds its dependencies to the DI container of the host application, including the string localizer implementation. The host application then sets its own implementation for `IStringLocalizer`, which might load strings from a database, overwriting the previous implementation. Now the module's controllers and views will be using the wrong implementation of the string localizer, and the module's message strings will not be loaded.\r\n\r\nIf each module (or assembly or logical set of controllers/views) had its own child container, the instances would be isolated, and each module could have its own set of implementations, which would first be resolved from the child container, and then fall back to the parent container when not found.\r\n\r\nThis is just one example, and I'm sure there are many more.\r\n\r\n/cc @brockallen @mdekrey (from https://github.com/aspnet/Announcements/issues/28)"}}