title: Injectable singleton service yet not new()able .net core
body: <p>Using .net-core DI framework, I'm registering my Foo service as singleton:</p>
  <pre><code> services.AddSingleton&lt;IFoo, Foo&gt;();
  </code></pre>
  <p>Yet, I don't want any other developer to create new instance of Foo service:</p>
  <pre><code>var storage = new TokenStorage();  // bad practice, not allowed
  </code></pre>
  <p>I know I can make Foo service internally singleton with non-accessible constructor like below:</p>
  <pre><code>public class Foo : IFoo 
  {
     private static _instance;
     
     protected Foo() {}
     
     public static IFoo GetInstance()
     { 
        return _instance ??= new Foo();
     }
  }
  </code></pre>
  <p>But I don't want traditional way of accessing this service using <em><strong>Foo.GetInstance().Bar()</strong></em></p>
  <p>In simple words, I want DI framework to make Foo singleton and yet abandon developers from instantiating it by new Foo(), without using Singleton pattern.</p>
  <p>Is there any way or pattern to achieve this?</p>