How to use the typedi/Container.Container function in typedi

To help you get started, we’ve selected a few typedi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github iWinston / typeorm-plus / src / decorator / OrmRepository.ts View on Github external
return function(target: Function, key: string, index: number) {

        let container: any;
        try {
            container = require("typedi/Container").Container;
        } catch (err) {
            throw new Error("OrmRepository cannot be used because typedi extension is not installed.");

            type: target,
            index: index,
            getValue: () => {
                const connectionManager: ConnectionManager = container.get(ConnectionManager);
                const connection = connectionManager.getConnection(connectionName);
                return connection.getRepository(cls);