title: Simplified approach to IOptions<T>
body: <p>I am trying to get a .NET Framework class library in line with an ASP.NET Core 2.1 application while using builtin DI mechanism. Now, I created a config class and added appropriate section to appsettings.json:</p>
  
  <pre><code>services.Configure&lt;MyConfig&gt;(Configuration.GetSection("MyConfiguration"));
  services.AddScoped&lt;MyService&gt;();
  </code></pre>
  
  <p>In class lib: </p>
  
  <pre><code>public class MyService 
  {
      private readonly MyConfig _config;
  
      public MyService(IOptions&lt;MyConfig&gt; config)
      {
          _config = config.Value;
      }
  }
  </code></pre>
  
  <p>However, in order to build this classlib I have to add <code>Microsoft.Extensions.Options</code> NuGet package. The problem is that package carries a hell of a lot of dependencies which seem rather excessive to add just for the sake of one interface. </p>
  
  <p><a href="https://i.stack.imgur.com/DWBHz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DWBHz.png" alt="enter image description here"></a></p>
  
  <p>So, the question ultimately is, "is there another approach I can take to configure a DI service located in .NET Framework class library which is not dependency heavy?</p>