title: How to inject an asynchronous dependency in inversify?
body: <p>I have TypeScript application and I'm using <a href="http://inversify.io/" rel="noreferrer">Inversify</a> for IoC.</p>
  
  <p>I have a connection class:</p>
  
  <pre><code>'use strict';
  import { injectable } from 'inversify';
  import { createConnection, Connection } from "typeorm";
  import { Photo, PhotoMetadata, Author, Album } from '../index';
  
  @injectable()
  class DBConnectionManager {
  
      public createPGConnection(): Promise&lt;Connection&gt; {
          return createConnection({
              driver: {
                  type: "postgres",
                  host: "host",
                  port: 5432,
                  username: "username",
                  password: "password",
                  database: "username"
              },
              entities: [
                  Photo, PhotoMetadata, Author, Album
              ],
              autoSchemaSync: true,
          });
  
      }
  
  }
  
  export { DBConnectionManager };
  </code></pre>
  
  <p>After I created my connection I want to bind a connection into my container:</p>
  
  <pre><code>kernel.bind&lt;Connection&gt;('DefaultConnection').toConstantValue(getConnectionManager().get());
  </code></pre>
  
  <p>and then I want to inject it into another class:</p>
  
  <pre><code>import { injectable, inject } from 'inversify';
  import { Connection, FindOptions } from "typeorm";
  import { IGenericRepository, ObjectType } from '../index';
  
  
      @injectable()
      class GenericRepository&lt;T&gt; implements IGenericRepository&lt;T&gt; {
  
          private connection: Connection;
          private type: ObjectType&lt;T&gt;;
  
          constructor( @inject('DefaultConnection') connection: Connection) {
              this.connection = connection;
          }
  </code></pre>
  
  <p>So in my container configuration how can I bind DefaultConnection that needs to wait for CreateConnection 
  I can do with async and wait but I'm wonder if there is a cleaner way to achive this in <a href="http://inversify.io/" rel="noreferrer">inversify</a></p>