|
8 | 8 |
|
9 | 9 | Your interaction with the database is only possible once you setup a `DataSource`.
|
10 | 10 | TypeORM's `DataSource` holds your database connection settings and
|
11 |
| -establishes initial database connection or connection pool depending on the RDBMS you use. |
| 11 | +establishes the initial database connection or connection pool depending on the RDBMS you use. |
12 | 12 |
|
13 |
| -In order to establish initial connection / connection pool you must call `initialize` method of your `DataSource` instance. |
| 13 | +To establish the initial connection/connection pool, you must call the `initialize` method of your `DataSource` instance. |
14 | 14 |
|
15 |
| -Disconnection (closing all connections in the pool) is made when `destroy` method is called. |
| 15 | +Disconnection (closing all connections in the pool) occurs when the `destroy` method is called. |
16 | 16 |
|
17 |
| -Generally, you call `initialize` method of the `DataSource` instance on application bootstrap, |
18 |
| -and `destroy` it after you completely finished working with the database. |
| 17 | +Generally, you call the `initialize` method of the `DataSource` instance on the application bootstrap, |
| 18 | +and `destroy` it after you finished working with the database. |
19 | 19 | In practice, if you are building a backend for your site and your backend server always stays running -
|
20 | 20 | you never `destroy` a DataSource.
|
21 | 21 |
|
@@ -45,11 +45,10 @@ AppDataSource.initialize()
|
45 | 45 | })
|
46 | 46 | ```
|
47 | 47 |
|
48 |
| -It's a good idea to make `AppDataSource` globally available by `export`-ing it, since you'll |
49 |
| -use this instance across your application. |
| 48 | +It's a good idea to make `AppDataSource` globally available by `export`-ing it since you'll use this instance across your application. |
50 | 49 |
|
51 |
| -`DataSource` accepts `DataSourceOptions` and those options vary depend on database `type` you use. |
52 |
| -For different database types there are different options you can specify. |
| 50 | +`DataSource` accepts `DataSourceOptions` and those options vary depending on the database `type` you use. |
| 51 | +For different database types, there are different options you can specify. |
53 | 52 |
|
54 | 53 | You can define as many data sources as you need in your application, for example:
|
55 | 54 |
|
@@ -97,6 +96,6 @@ export class UserController {
|
97 | 96 | }
|
98 | 97 | ```
|
99 | 98 |
|
100 |
| -Using `DataSource` instance you can execute database operations with your entities, |
| 99 | +Using the `DataSource` instance you can execute database operations with your entities, |
101 | 100 | particularly using `.manager` and `.getRepository()` properties.
|
102 | 101 | For more information about them see [Entity Manager and Repository](working-with-entity-manager.md) documentation.
|
0 commit comments