MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / create

Method create

packages/core/src/utils/RequestContext.ts:26–33  ·  view source on GitHub ↗

* Creates new RequestContext instance and runs the code inside its domain. * If the handler is async, the return value needs to be awaited. * Uses `AsyncLocalStorage.run()`, suitable for regular express style middlewares with a `next` callback.

(
    em: EntityManager | EntityManager[],
    next: (...args: any[]) => T,
    options: CreateContextOptions = {},
  )

Source from the content-addressed store, hash-verified

24 * Uses `AsyncLocalStorage.run()`, suitable for regular express style middlewares with a `next` callback.
25 */
26 static create<T>(
27 em: EntityManager | EntityManager[],
28 next: (...args: any[]) => T,
29 options: CreateContextOptions = {},
30 ): T {
31 const ctx = this.createContext(em, options);
32 return this.storage.run(ctx, next);
33 }
34
35 /**
36 * Creates new RequestContext instance and runs the code inside its domain.

Callers

nothing calls this directly

Calls 2

createContextMethod · 0.95
runMethod · 0.65

Tested by

no test coverage detected