Replies: 1 comment 3 replies
-
@zplan container.Register<MyFactory>(); // registering the factory to access it via service information below
container.Register<MyType>(Made.Of(
r => ServiceInfo.Of<MyFactory>(), // the factory to resolve and pass as an argument to the factory method
myFactory => myFactory.Create(Arg.Index<String>(0)), // substitute the Arg of type String with the value provided by the 0 delegate below
request => request.ServiceKey)); Check the docs here https://github.com/dadhi/DryIoc/blob/master/docs/DryIoc.Docs/SelectConstructorOrFactoryMethod.md#using-instance-factory-method |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have the following factory class which should create an object based on the service key when resolve is called:
Is there somehow a way accessing the servicekey?
That the consumer can call resolve like this:
Beta Was this translation helpful? Give feedback.
All reactions