title: What is best way to inject configured options instance into a scoped service?
body: <p>I have a service class (DynamicsConnector) which depends on another options class (DynamicsConnectorOptions). Following dependency injection I need to inject (DynamicsConnectorOptions) into (DynamicsConnector).</p>
  
  <p>after hours of searching I have found one way to do it as in below code:</p>
  
  <pre><code>    //Code snippet for target dependency injection classes
      public class DynamicsConnector : IDynamicsConnector
      {
          DynamicsConnectorOptions options { get; set; }
          public DynamicsConnector(DynamicsConnectorOptions options)
          {
             this.options = options;
          }
      }        
  
      //Code snippet for configuring and registering classes
      public void ConfigureServices(IServiceCollection services)
      {
          services.AddMvc();
          services.AddOptions();
  
          var settings = Configuration.GetSection("DynamicsConnector");
          services.Configure&lt;DynamicsConnectorOptions&gt;(settings);
  
          DynamicsConnectorOptions options = new DynamicsConnectorOptions();
          settings.Bind(options);
          services.AddScoped(x =&gt; options);
          services.AddScoped&lt;IDynamicsConnector, DynamicsConnector&gt;();
      }
  </code></pre>
  
  <p>This code works just fine. However, I have the following questions:</p>
  
  <ol>
  <li>from a design perspective, is it a good idea to let an option class depends directly on another service class?</li>
  <li>if yes, is it a good practice to do it this way, or there is more robust and elegant way to inject options class into another service class?</li>
  </ol>