{"push_id":3006472675,"size":1,"distinct_size":1,"ref":"refs/heads/patch-2","head":"2fd83d2f27d4fd46bf0c049fb9b78f9e929aa355","before":"ba2d73f245ec92f8d67538e2409ec55d2c5cdb7d","commits":[{"sha":"2fd83d2f27d4fd46bf0c049fb9b78f9e929aa355","author":{"name":"Tony Xiao","email":"642b1295869484e0a76e3f069d83b3a0e6d6ea58@gmail.com"},"message":"Pass identifier to factory and object constructors\n\nThis is useful for factory functions that handles the creation of multiple types of services\r\n.e.g Without identifier\r\n\r\n```ts\r\n@Service({\r\n  factory: (container: ContainerInstance) => {\r\n    const manager = container.get(EntityManager)\r\n    return manager.getCustomRepository(AccountRepository)\r\n  },\r\n})\r\n@EntityRepository(Account)\r\nexport class AccountRepository extends BaseRepository<Account> {\r\n```\r\n\r\nWith identifier\r\n```ts\r\n// This factory can now be made generic rather than having to be re-defined for every single repository.\r\n@Service({\r\n  factory: (container: ContainerInstance, identifier: any) => {\r\n    const manager = container.get(EntityManager)\r\n    return manager.getCustomRepository(identifier)\r\n  },\r\n})\r\n@EntityRepository(Account)\r\nexport class AccountRepository extends BaseRepository<Account> {\r\n```","distinct":true,"url":"https://api.github.com/repos/tonyxiao/typedi/commits/2fd83d2f27d4fd46bf0c049fb9b78f9e929aa355"}]}
{"actor":{"display_login":"tonyxiao"}}