title: How do I access DI registered instance from within POCO?
body: <p>This is in a .NET Core project. In the Startup I register a singleton for my translation service that gets initialized with configuration settings from appsettings.json. Once it's set the whole app will use that service. This works great in my controllers and repositories, I just define the constructor to take that interface and it injects as expected:</p>
  
  <pre><code>services.AddSingleton&lt;Foo.Bar.ITranslationService&gt;(
      new Foo.Bar.SomeTranslator(config.TranslationSettings));
  </code></pre>
  
  <p>But the issue I ran into is one where a POCO needed to use that translation service. And my POCOs all get generated as generics by the repository, so for example a repository method might look like this:</p>
  
  <pre><code>public TEntity GetById(object id){
      return connection.Get&lt;TEntity&gt;(id);
  }
  </code></pre>
  
  <p>So the repository has the injected TranslationService passed into it, but is there a way to cleanly pass that along to the POCO that needs it using DI? Or do I need to hack it somehow? I'm trying to figure out the cleanest way to do this, thanks!</p>