Closed med-qh closed 4 years ago
The problem is that you are trying to make an async injection to the container and it is not supported by this library
The container has a sync interface when you try to retrieve an instance:
let instance = Container.get(SomeType); // so I need providers that returns synchronously
Hi, Basically we are using the Hyperledger client to build our application and we are working on a rest api interfacing with the chain.
I have a class called HyperledgerChainClient which inherits BusinessNetworkConnection (a class provided by hyperledger) i need it to be instantiated and connected when my server starts, so my connection will always be the same. my class looks like this
To achieve this i tried creating a provider for my repository which looks like this
But for some reason the injection of my repository into my service always happen after the connection, so i am getting errors like
(The connection error is normal i have not yet initialized my chain). Also my only problem actually comes from the injection of my repository into my services. I already use the hyperledger package on other projects and it works fine so i am guessing the problem comes from my code ?.
Please tell me if this is unclear. Also how would you deal with injecting repositories connected to other than hyperledger such as databases per example. As i need it to be connected only once at the start.