@@ -33,7 +33,7 @@ createConnection({
3333All decorators can be used on properties and constructor arguments, e.g. you can use both
3434property and constructor injection.
3535
36- ### @OrmConnection
36+ ### @InjectConnection
3737
3838Injects ` Connection ` from where you can access anything in your connection.
3939
@@ -42,12 +42,12 @@ Example using property injection:
4242``` typescript
4343import {Service } from " typedi" ;
4444import {Connection } from " typeorm" ;
45- import {OrmConnection } from " typeorm-typedi-extensions" ;
45+ import {InjectConnection } from " typeorm-typedi-extensions" ;
4646
4747@Service ()
4848export class PostRepository {
4949
50- @OrmConnection ()
50+ @InjectConnection ()
5151 private connection: Connection ;
5252
5353}
@@ -58,20 +58,20 @@ Example using constructor injection:
5858``` typescript
5959import {Service } from " typedi" ;
6060import {Connection } from " typeorm" ;
61- import {OrmConnection } from " typeorm-typedi-extensions" ;
61+ import {InjectConnection } from " typeorm-typedi-extensions" ;
6262
6363@Service ()
6464export class PostRepository {
6565
66- constructor (@OrmConnection () private connection : Connection ) {
66+ constructor (@InjectConnection () private connection : Connection ) {
6767 }
6868
6969}
7070```
7171
7272Optionally, you can specify a connection name in the decorator parameters.
7373
74- ### @OrmManager
74+ ### @InjectManager
7575
7676Injects ` EntityManager ` from where you can access any entity in your connection.
7777
@@ -80,12 +80,12 @@ Example using property injection:
8080``` typescript
8181import {Service } from " typedi" ;
8282import {EntityManager } from " typeorm" ;
83- import {OrmManager } from " typeorm-typedi-extensions" ;
83+ import {InjectManager } from " typeorm-typedi-extensions" ;
8484
8585@Service ()
8686export class PostRepository {
8787
88- @OrmManager ()
88+ @InjectManager ()
8989 private entityManager: EntityManager ;
9090
9191}
@@ -96,36 +96,36 @@ Example using constructor injection:
9696``` typescript
9797import {Service } from " typedi" ;
9898import {EntityManager } from " typeorm" ;
99- import {OrmManager } from " typeorm-typedi-extensions" ;
99+ import {InjectManager } from " typeorm-typedi-extensions" ;
100100
101101@Service ()
102102export class PostRepository {
103103
104- constructor (@OrmManager () private entityManager : EntityManager ) {
104+ constructor (@InjectManager () private entityManager : EntityManager ) {
105105 }
106106
107107}
108108```
109109
110110Optionally, you can specify a connection name in the decorator parameters.
111111
112- ### @OrmRepository
112+ ### @InjectRepository
113113
114114Injects ` Repository ` , ` MongoRepository ` , ` TreeRepository ` or custom repository of some Entity.
115- Be aware that the property or param decorated with ` @OrmRepository ` has to be annotated with repository type!
115+ Be aware that the property or param decorated with ` @InjectRepository ` has to be annotated with repository type!
116116
117117Example using property injection:
118118
119119``` typescript
120120import {Service } from " typedi" ;
121121import {Repository } from " typeorm" ;
122- import {OrmRepository } from " typeorm-typedi-extensions" ;
122+ import {InjectRepository } from " typeorm-typedi-extensions" ;
123123import " ../entity/Post" ;
124124
125125@Service ()
126126export class PostRepository {
127127
128- @OrmRepository (Post )
128+ @InjectRepository (Post )
129129 private repository: Repository <Post >;
130130
131131}
@@ -136,14 +136,14 @@ Example using constructor injection:
136136``` typescript
137137import {Service } from " typedi" ;
138138import {Repository } from " typeorm" ;
139- import {OrmRepository } from " typeorm-typedi-extensions" ;
139+ import {InjectRepository } from " typeorm-typedi-extensions" ;
140140import " ../entity/Post" ;
141141
142142@Service ()
143143export class PostRepository {
144144
145145 constructor (
146- @OrmRepository (Post )
146+ @InjectRepository (Post )
147147 private repository : Repository <Post >
148148 ) {}
149149
@@ -155,7 +155,7 @@ Optionally, you can specify a connection name in the decorator parameters:
155155@Service ()
156156export class PostRepository {
157157
158- @OrmRepository (Post , " custom-con-name" )
158+ @InjectRepository (Post , " custom-con-name" )
159159 private repository: Repository <Post >;
160160
161161}
@@ -169,7 +169,7 @@ Example using constructor injection:
169169``` typescript
170170import { Service } from " typedi" ;
171171import { Repository , EntityRepository } from " typeorm" ;
172- import { OrmRepository } from " typeorm-typedi-extensions" ;
172+ import { InjectRepository } from " typeorm-typedi-extensions" ;
173173import " ../entity/user" ;
174174
175175// create custom Repository class
@@ -188,7 +188,7 @@ export class PostService {
188188
189189 // using constructor injection
190190 constructor (
191- @OrmRepository ()
191+ @InjectRepository ()
192192 private readonly userRepository : UserRepository ,
193193 ) {}
194194
@@ -205,7 +205,7 @@ Optionally, you can specify a connection name in the decorator parameters.
205205@Service ()
206206export class PostService {
207207
208- @OrmRepository (" custom-con-name" )
208+ @InjectRepository (" custom-con-name" )
209209 private userRepository: UserRepository ;
210210
211211}
0 commit comments