ipjohnson / Grace

Grace is a feature rich dependency injection container library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[question] Locate with parameters

JBurlison opened this issue · comments

I was looking at https://github.com/ipjohnson/Grace/wiki/Injection-Context#extradata for injecting parameters into a locate. I was wondering if it was required to pass a dynamic object every time?

Is there other supported extra data objects such as Dictionary<string, object> of Key = parameter name, Value = parameter value or just an array of objects[] and say my method has all the parameters that need to be added via extra data front loaded

public SomeClass(string someExtraData1, string someExtraData2, MyDIObject diObject1, MyOtherDiObject diObject2)

So I could locate it by passing

container.Locate<SomeClass>(new[] { runtimeString1, runtimeString2 }); // these would fill someExtraData1, someExtraData2
// OR
container.Locate<SomeClass>(new Dictionary<string, object>() { { "someExtraData1", runtimeString1 }, { "someExtraData2", someExtraData2 } });