What is EntityManager
Using EntityManager you can manage (insert, update, delete, load, etc.) any entity. EntityManager is just like a collection of all entity repositories in a single place.
You can access the entity manager via getManager() or from Connection. Example how to use it:
1
import {getManager} from "typeorm";
2
import {User} from "./entity/User";
3
​
4
const entityManager = getManager(); // you can also get it via getConnection().manager
5
const user = await entityManager.findOne(User, 1);
6
user.name = "Umed";
7
await entityManager.save(user);
Copied!
Last modified 1mo ago
Copy link