You need to provide some classes and decorators yourself to maintain the same style as [email protected]
.
@EntityRepository(UserEntity)
export class UserRepository extends Repository<UserEntity> {}
↓
@CustomRepository(UserEntity)
export class UserRepository extends Repository<UserEntity> {}
@Module({
exports: [UserService],
imports: [TypeOrmModule.forFeature([UserRepository])],
providers: [UserService],
})
export class UserModule {}
↓
@Module({
exports: [UserService],
imports: [TypeOrmExModule.forCustomRepository([UserRepository])],
providers: [UserService],
})
export class UserModule {}
Hey everyone. If you want to use transactions in a simpler way, there's a pretty cool lib that uses
cls-hooked
for that:But we have to modify how custom repositories are provided in
typeorm-ex.module.ts
as suggested by the author of the lib:Hope this can be helpful to someone. It worked great for me!