{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/AspNetCore.Docs/issues/13471","repository_url":"https://api.github.com/repos/aspnet/AspNetCore.Docs","labels_url":"https://api.github.com/repos/aspnet/AspNetCore.Docs/issues/13471/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/AspNetCore.Docs/issues/13471/comments","events_url":"https://api.github.com/repos/aspnet/AspNetCore.Docs/issues/13471/events","html_url":"https://github.com/aspnet/AspNetCore.Docs/pull/13471","id":472260763,"node_id":"MDExOlB1bGxSZXF1ZXN0MzAwNzA1ODYx","number":13471,"title":"Update DI example","user":{"login":"guardrex","id":1622880,"node_id":"MDQ6VXNlcjE2MjI4ODA=","avatar_url":"https://avatars1.githubusercontent.com/u/1622880?v=4","gravatar_id":"","url":"https://api.github.com/users/guardrex","html_url":"https://github.com/guardrex","followers_url":"https://api.github.com/users/guardrex/followers","following_url":"https://api.github.com/users/guardrex/following{/other_user}","gists_url":"https://api.github.com/users/guardrex/gists{/gist_id}","starred_url":"https://api.github.com/users/guardrex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guardrex/subscriptions","organizations_url":"https://api.github.com/users/guardrex/orgs","repos_url":"https://api.github.com/users/guardrex/repos","events_url":"https://api.github.com/users/guardrex/events{/privacy}","received_events_url":"https://api.github.com/users/guardrex/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2019-07-24T12:40:56Z","updated_at":"2019-07-24T14:52:45Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/aspnet/AspNetCore.Docs/pulls/13471","html_url":"https://github.com/aspnet/AspNetCore.Docs/pull/13471","diff_url":"https://github.com/aspnet/AspNetCore.Docs/pull/13471.diff","patch_url":"https://github.com/aspnet/AspNetCore.Docs/pull/13471.patch"},"body":"Fixes #13450\r\n\r\n* In this example (instructing the reader to avoid the service locator pattern), `MyClass` isn't a registered service ... it's just a class example ... so it's fine in its present form. However, @moikot correctly calls out that *IF* the pattern shown in the example were to be adopted by a singleton service that it won't work and probably isn't the best example.\r\n* Let's inject `IOptionsMonitor<MyOptions>`, then pull the `CurrentValue` in the `MyMethod`. That will always work if this pattern were to become part of a singleton.\r\n* This whole topic is coming up for a 3.0 update in a few weeks. I'll comb thru it (and take a look at the Options topic when it comes up) to see if any other little *gotchas* like this might be lurking.\r\n\r\nThanks @moikot for calling this out. 🎸"},"comment":{"url":"https://api.github.com/repos/aspnet/AspNetCore.Docs/issues/comments/514666032","html_url":"https://github.com/aspnet/AspNetCore.Docs/pull/13471#issuecomment-514666032","issue_url":"https://api.github.com/repos/aspnet/AspNetCore.Docs/issues/13471","id":514666032,"node_id":"MDEyOklzc3VlQ29tbWVudDUxNDY2NjAzMg==","user":{"login":"HaoK","id":6537861,"node_id":"MDQ6VXNlcjY1Mzc4NjE=","avatar_url":"https://avatars2.githubusercontent.com/u/6537861?v=4","gravatar_id":"","url":"https://api.github.com/users/HaoK","html_url":"https://github.com/HaoK","followers_url":"https://api.github.com/users/HaoK/followers","following_url":"https://api.github.com/users/HaoK/following{/other_user}","gists_url":"https://api.github.com/users/HaoK/gists{/gist_id}","starred_url":"https://api.github.com/users/HaoK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HaoK/subscriptions","organizations_url":"https://api.github.com/users/HaoK/orgs","repos_url":"https://api.github.com/users/HaoK/repos","events_url":"https://api.github.com/users/HaoK/events{/privacy}","received_events_url":"https://api.github.com/users/HaoK/received_events","type":"User","site_admin":false},"created_at":"2019-07-24T14:52:45Z","updated_at":"2019-07-24T14:52:45Z","author_association":"MEMBER","body":"This update is good, this is the general recommended pattern"}}
{"actor":{"display_login":"HaoK"}}