Factory
Factory used to define runtime custom injections.
Singleton Factory#
The return value of the factory get method will be injected to class properties;
Factory object must have implement IFactory method that will be called in order to inject the object instance.
the get method can return promise;
Factories are singletons and initialized first.
once all the factories loaded, inject initialize process continues
now we can use mail factory. mailProvider provider will be awsMailProvider or googleMailProvider based on our env;
Dynamic Factory#
dynamic factories can be used when creating not singleton classes
the return value of the factory get method will be injected.