title: Dynamically Updating Dependency Injection Service
body: <p>Background: Asp.Net Core website using Dependency Injection to relay needed services to various parts of the website</p>
  
  <p>I have a service that is being added to the IServiceCollection in the ConfigureServices method in my Startup class as a <strong>singleton</strong> in the following manner:</p>
  
  <pre><code>//Settings
  services.AddSingleton&lt;ISettingsService, SettingsService&gt;();
  services.AddSingleton&lt;ISettingsIO, SettingsIO&gt;();
  services.AddSingleton&lt;ISettings&gt;(f =&gt;
  {
      return f.GetService&lt;ISettingsService&gt;().GetSettings();
  });
  </code></pre>
  
  <p>This works great and all the pages/controllers I need to have access to Example can do so without issue.</p>
  
  <p>However, I now have the capability to change the data that is being pulled in the method GetSettings(). This means that I need to <strong>update</strong> the service that is added to the ServiceCollection.</p>
  
  <p>How can I do this <strong>without</strong> changing the service from a singleton to transient?</p>
  
  <p>Thanks for any help provided!</p>