@@ -40,11 +40,12 @@ import { Container } from 'typedi';
40
40
useContainer (Container );
41
41
42
42
/** Create a connection and start using TypeORM. */
43
- createConnection ({ /* <connection options> */ })
44
- .catch (error => {
45
- console .error (` Couldn't connect to the database! ` );
46
- console .error (error );
47
- });
43
+ createConnection ({
44
+ /* <connection options> */
45
+ }).catch (error => {
46
+ console .error (` Couldn't connect to the database! ` );
47
+ console .error (error );
48
+ });
48
49
```
49
50
50
51
## Usage
@@ -66,7 +67,6 @@ import { InjectConnection } from 'typeorm-typedi-extensions';
66
67
67
68
@Service ()
68
69
export class MyCustomClass {
69
-
70
70
@InjectConnection ()
71
71
private propertyInjectedConnection: Connection ;
72
72
@@ -86,7 +86,6 @@ import { InjectManager } from 'typeorm-typedi-extensions';
86
86
87
87
@Service ()
88
88
export class MyCustomClass {
89
-
90
89
@InjectManager ()
91
90
private propertyInjectedEntityManager: EntityManager ;
92
91
@@ -108,15 +107,14 @@ import { MyDatabaseModel } from './entities/post.entity.ts';
108
107
109
108
@Service ()
110
109
export class MyCustomClass {
111
-
112
110
@InjectRepository (MyDatabaseModel )
113
111
private propertyInjectedRepository: Repository <MyDatabaseModel >;
114
112
115
113
constructor (@InjectRepository (MyDatabaseModel ) private constructorInjectedRepository : Repository <MyDatabaseModel >) {}
116
114
}
117
115
```
118
116
119
- Example with custom connection name:
117
+ Example with custom connection name:
120
118
121
119
``` ts
122
120
@Service ()
@@ -159,4 +157,4 @@ export class PostService {
159
157
}
160
158
```
161
159
162
- [ typedi ] : https://github.com/typestack/typedi
160
+ [ typedi ] : https://github.com/typestack/typedi
0 commit comments