{"action":"created","issue":{"url":"https://api.github.com/repos/smudge202/compose/issues/83","labels_url":"https://api.github.com/repos/smudge202/compose/issues/83/labels{/name}","comments_url":"https://api.github.com/repos/smudge202/compose/issues/83/comments","events_url":"https://api.github.com/repos/smudge202/compose/issues/83/events","html_url":"https://github.com/smudge202/compose/issues/83","id":87373165,"number":83,"title":"Tertiary Provider extensions","user":{"login":"smudge202","id":2247869,"avatar_url":"https://avatars.githubusercontent.com/u/2247869?v=3","gravatar_id":"","url":"https://api.github.com/users/smudge202","html_url":"https://github.com/smudge202","followers_url":"https://api.github.com/users/smudge202/followers","following_url":"https://api.github.com/users/smudge202/following{/other_user}","gists_url":"https://api.github.com/users/smudge202/gists{/gist_id}","starred_url":"https://api.github.com/users/smudge202/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smudge202/subscriptions","organizations_url":"https://api.github.com/users/smudge202/orgs","repos_url":"https://api.github.com/users/smudge202/repos","events_url":"https://api.github.com/users/smudge202/events{/privacy}","received_events_url":"https://api.github.com/users/smudge202/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/smudge202/compose/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/smudge202/compose/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/smudge202/compose/milestones/12","html_url":"https://github.com/smudge202/compose/milestones/0.1.6-beta","labels_url":"https://api.github.com/repos/smudge202/compose/milestones/12/labels","id":1230229,"number":12,"title":"0.1.6-beta","description":"","creator":{"login":"smudge202","id":2247869,"avatar_url":"https://avatars.githubusercontent.com/u/2247869?v=3","gravatar_id":"","url":"https://api.github.com/users/smudge202","html_url":"https://github.com/smudge202","followers_url":"https://api.github.com/users/smudge202/followers","following_url":"https://api.github.com/users/smudge202/following{/other_user}","gists_url":"https://api.github.com/users/smudge202/gists{/gist_id}","starred_url":"https://api.github.com/users/smudge202/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smudge202/subscriptions","organizations_url":"https://api.github.com/users/smudge202/orgs","repos_url":"https://api.github.com/users/smudge202/repos","events_url":"https://api.github.com/users/smudge202/events{/privacy}","received_events_url":"https://api.github.com/users/smudge202/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":1,"state":"open","created_at":"2015-07-28T20:28:09Z","updated_at":"2015-08-06T13:41:14Z","due_on":null,"closed_at":null},"comments":19,"created_at":"2015-06-11T14:51:59Z","updated_at":"2015-08-20T19:47:24Z","closed_at":null,"body":"We add providers for interfaces typically through Service Extensions created by the provider. These service extensions will take form in one of two ways:\r\n\r\n#### `Add`\r\n\r\nIf the service extension simply adds itself to the `IServiceCollection`, the MS provider (at time of writing) will resolve duplicated bindings using the **last** added binding.\r\n\r\ni.e.\r\n\r\n```c#\r\nservices\r\n  .AddProvider1()\r\n  .AddProvider2(); // provider 2 will be used\r\n```\r\n\r\n#### `TryAdd`\r\n\r\nIf the service extension uses the `TryAdd`  extension, it will only add a service descriptor if one does not already exist, meaning the **first** binding added will be used.\r\n\r\ni.e.\r\n\r\n```c#\r\nservices\r\n  .AddProvider1() /* provider 1 will be used */\r\n  .AddProvider2();\r\n```\r\n\r\nAs you can hopefully see from the example, there is no way of knowing from the application host which of the providers will be used.\r\n\r\nWhen performing a _Transition_, Compose will attempt to retrieve instances of the new implementation using the underlying provider, allowing the new implementations to utilise dependency injection. However, given the above extension behaviour, it is difficult for consumers to add both providers into the Service Collection during composition, because of the ambiguity in provider selection.\r\n\r\nI propose providing an API that allows the end user to have multiple service collections (potentially one per provider). There is of course the consideration of shared components between the service collections though. I'd be interested to hear some thoughts on this, and particularly any suggestions regarding an API that can achieve the above?"},"comment":{"url":"https://api.github.com/repos/smudge202/compose/issues/comments/133151231","html_url":"https://github.com/smudge202/compose/issues/83#issuecomment-133151231","issue_url":"https://api.github.com/repos/smudge202/compose/issues/83","id":133151231,"user":{"login":"smudge202","id":2247869,"avatar_url":"https://avatars.githubusercontent.com/u/2247869?v=3","gravatar_id":"","url":"https://api.github.com/users/smudge202","html_url":"https://github.com/smudge202","followers_url":"https://api.github.com/users/smudge202/followers","following_url":"https://api.github.com/users/smudge202/following{/other_user}","gists_url":"https://api.github.com/users/smudge202/gists{/gist_id}","starred_url":"https://api.github.com/users/smudge202/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smudge202/subscriptions","organizations_url":"https://api.github.com/users/smudge202/orgs","repos_url":"https://api.github.com/users/smudge202/repos","events_url":"https://api.github.com/users/smudge202/events{/privacy}","received_events_url":"https://api.github.com/users/smudge202/received_events","type":"User","site_admin":false},"created_at":"2015-08-20T19:47:24Z","updated_at":"2015-08-20T19:47:24Z","body":"C'mon then, I'm in the mood to code. Let's get this bad boy rolling... (inb4 drunken commit breaks appveyor - the site, not the build)."}}