title: Register multiple singletons with same interface but different constructor parameters values
body: <p>I got stuck and need some advice or pointer to a solution.</p>
  
  <p>A web API with ASP.NET Core 3.1</p>
  
  <p>Startup.cs</p>
  
  <pre><code>services.AddSingleton&lt;ITopicClient&gt;(s =&gt; new TopicClient({connectionstring},{topic}));
  </code></pre>
  
  <p>TopicRepository.cs</p>
  
  <pre><code> public class TopicRepository : ITopicRepository
   {
          private readonly ITopicClient _topicClient1;
         private readonly ITopicClient _topicClient2;
  
          public TopicRepository (ITopicClient topicClient1, ITopicClient topicClient2)
          {         
              _topicClient1 = topicClient1;
              _topicClient2 = topicClient2;
          }
          public async Task&lt;Response&gt; SendToTopicAsync(string message, string topic)
          {
             if( topic == "topic1")
             await _topicClient1.send(message);
             else if (topic == "topic2")
             await _topicClient2.send(message);
          }
  }
  </code></pre>
  
  <p>TopicClient.cs in a <strong>shared library</strong></p>
  
  <pre><code>        public TopicClient(string serviceBusConnectionString, string topicName)
          {
             _topicClient = new TopicClient(_serviceBusConnectionString,topicName);
          }
  </code></pre>
  
  <p>I need to send message to different topics. I would like to register services with different topic names in startup.cs. I want to reuse topicClient connection. </p>
  
  <p>services.AddSingleton(s => new TopicClient({connectionstring},{<strong>topic1</strong>}));</p>
  
  <p>services.AddSingleton(s => new TopicClient({connectionstring},{<strong>topic2</strong>}));</p>
  
  <p>How can I achieve this by registering singleton instances of same type using same interface ?</p>
  
  <p>Thank you in advance!</p>