injectable icon indicating copy to clipboard operation
injectable copied to clipboard

Restricted generic type service registration

Open TabooSun opened this issue 3 years ago • 0 comments

Say there is a service as such:

abstract class Repository<TEntity extends EntityDto> {
}

as for the implementation service:

class AppRepository<TEntity extends EntityDto> extends Repository<TEntity>{
}

This is how I am registering currently:

GetIt.I.registerFactory<Repository<Student>>(
  () => AppRepository<Student>(),
);

Is it possible to decorate the Student class with a new decorator to include in the injectable build? Example:

@getItType
class EfPanel extends EntityDto {
}

Or any other solution will do.

TabooSun avatar Feb 22 '22 10:02 TabooSun