title: How do I configure mvc core 2 dependency injection with parameters, where one of the parameters is a dependency?
body: <p>If I have:</p>
  
  <p><code>public CatManager(ICatCastle catCastle, int something)</code></p>
  
  <p>I want to set this up to be dependency injected, but I am not sure how.</p>
  
  <p>I think I can do this:</p>
  
  <pre><code>services.AddScoped&lt;ICatCastle, CatCastle&gt;();
  
  services.AddScoped&lt;ICatManager&gt;(new CatManager(???, 42));
  </code></pre>
  
  <p>But I am not sure what to put in as the <code>???</code> to get the CatCastle. I'd like it to resolve a new <code>CatCastle</code> every time <code>CatManager</code> is injected.</p>
  
  <p>As a further step, I wonder if it possible to do something like:</p>
  
  <pre><code>public CatManager(int something)
  
  services.AddScoped&lt;ICatManager&gt;(new CatManager(ResolveICatCastleIntoCatCastle().SomeID));
  </code></pre>
  
  <p>So that CatManager's constructor is automatically invoked with the ID, but not the object that gets the IDs. For example, if it is a database connection I want that resolution to occur when it is created and not later on when the property is actually accessed.</p>