Allow customizing the Type matching policy at registration time #457
Replies: 1 comment
-
@hmartinez82 //cc @yallie Hi there. But I am open for ideas and PRs to resolve the aforementioned concerns, because all of this maybe just in my mind. Another alternative that may work for you @hmartinez82, may be laziness of loading the final type and use the type name until the service is really requested for resolution, e.g. use the DynamicServiceProvider. I have even added the supporting functionality both into DryIoc and DryIoc.Mef. If it is too complex, the good Idea would be to publish minimal example of code of what you want to achieve without using the container. But the example should be complete and compile-able, better in the form of unit test, so others may help you to transform to the working solution with DryIoc. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
DryIOC internally uses
RuntimeHelpers.GetHashCode(type)
for matching the type being asked for vs. the type that are registered.This leads to type mismatch when using embedded interop assemblies and asking for a container resolution from a different assembly that registered the type. As an example, in a scenario like this:
the types won't match.
Idea: Allow adding a custom type matcher when registering a type. So one can, for instance, tell DryIOC to not use the Type's hash, but instead a more relaxed matching policy like Namespace+ClassName
Beta Was this translation helpful? Give feedback.
All reactions