title: How to implement Resolver-Inheritance with Type-GraphQL, TypeORM, and dependency injection
body: <p>I am trying to extend upon the Type-GraphQL provided example of resolvers-inheritance except replace the static data with a TypeORM repository.</p>
  <p>Here is how the PersonResolver extends the ResourceResolver and how it passes the <code>persons</code> array as the second argument of the ResourceResolver constructor.</p>
  <pre><code>const persons: Person[] = [
    {
      id: 1,
      name: &quot;Person 1&quot;,
      age: 23,
      role: PersonRole.Normal,
    },
    {
      id: 2,
      name: &quot;Person 2&quot;,
      age: 48,
      role: PersonRole.Admin,
    },
  ];
  
  @Resolver()
  export class PersonResolver extends ResourceResolver(Person, persons) {
     ...
  }
  </code></pre>
  <p>Inside the ResourceResolver</p>
  <pre><code>export function ResourceResolver&lt;TResource extends Resource&gt;(
    ResourceCls: ClassType&lt;TResource&gt;,
    resources: TResource[],
  ) {
    const resourceName = ResourceCls.name.toLocaleLowerCase();
  
    // `isAbstract` decorator option is mandatory to prevent multiple registering in schema
    @Resolver(_of =&gt; ResourceCls, { isAbstract: true })
    @Service()
    abstract class ResourceResolverClass {
      protected resourceService: ResourceService&lt;TResource&gt;;
  
      constructor(factory: ResourceServiceFactory) {
        this.resourceService = factory.create(resources);
      }
  ...
  }
  </code></pre>
  <p>And in the ResourceServiceFactory</p>
  <pre><code>@Service()
  export class ResourceServiceFactory {
    create&lt;TResource extends Resource&gt;(resources?: TResource[]) {
      return new ResourceService(resources);
    }
  }
  
  export class ResourceService&lt;TResource extends Resource&gt; {
    constructor(protected resources: TResource[] = []) {}
  
      getOne(id: number): TResource | undefined {
      return this.resources.find(res =&gt; res.id === id);
  }
  
  </code></pre>
  <p>I would like to know the best way to implement the ResourceResolver but instead of static data I would like to pass a repository from TypeORM.</p>
  <p>Here is the original example - <a href="https://github.com/MichalLytek/type-graphql/tree/master/examples/resolvers-inheritance" rel="nofollow noreferrer">https://github.com/MichalLytek/type-graphql/tree/master/examples/resolvers-inheritance</a>.</p>
  <p>Any help or advice is greatly appreciated.</p>