@technove/typeorm-inject
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

@technove/typeorm-inject

This package provides @Inject support for TypeORM.

Installation

yarn add @technove/typeorm-inject @technove/inject reflect-metadata

Or on npm:

npm install --save @technove/typeorm-inject @technove/inject reflect-metadata

Then at the top of your application's entry point, add the following line:

import "reflect-metadata";

To use the package, add the following line to your application before you create a connection:

import { createConnection, useContainer } from "typeorm";
import { globalContainer } from "@technove/inject";

/** Tell TypeORM to use the container provided by @technove/inject to resolve it's dependencies. */
useContainer(globalContainer);

And finally in your tsconfig.json, set experimentalDecorators and emitDecoratorMetadata to true.

Usage

This library is heavily based off of typeorm-typedi-extensions. The usage of the @InjectConnection(), @InjectManager(), and @InjectRepository() is the exact same. In the future we'll have the docs built out to show the usage of the decorators.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @technove/typeorm-inject

Weekly Downloads

1

Version

0.0.1

License

MIT

Unpacked Size

25.3 kB

Total Files

25

Last publish

Collaborators

  • paulbgd