| 58 | } |
| 59 | |
| 60 | private static createContext( |
| 61 | em: EntityManager | EntityManager[], |
| 62 | options: CreateContextOptions = {}, |
| 63 | ): RequestContext { |
| 64 | const forks = new Map<string, EntityManager>(); |
| 65 | |
| 66 | if (Array.isArray(em)) { |
| 67 | em.forEach(em => forks.set(em.name, em.fork({ useContext: true, ...options }))); |
| 68 | } else { |
| 69 | forks.set(em.name, em.fork({ useContext: true, ...options })); |
| 70 | } |
| 71 | |
| 72 | return new RequestContext(forks); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | /** Options for creating a new RequestContext, allowing global overrides. */ |