-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ILocatorService.Locate using 'withKey' doesn't work for wrapped types. #185
Comments
Could you include your optional wrapper implementation and I can take a look this evening? |
I've been able to replicate this problem in my environment so I can fix it. The one thing I will say is that this resolution won't be fast. Grace only caches delegates for non keyed exports, which wouldn't be a problem because it would be cached at the export itself but it's a wrapped/keyed export which won't be cached. I can fix the problem for version 6.4.1 but I won't be fast. I think caching will need to be a different issue and I'd want to release version 6.5.0 for it as it's a major feature. |
Let me ask something: The IMissingDependencyExpressionProvider is used when i call the locate method? My wrapper implements also the IMissingDependencyExpressionProvider, and I'm configuring this way:
I realized that the IMissingDependencyExpressionProvider methods were not called from locate. Maybe using this strategy would solve the problem. |
@eglauko you are correct the After doing some digging the problem is going to affect all Wrapped/Keyed Locate requests. Essentially the Now to the bad news I don't think I'm going to be able to start Grace 7 till next year because of a number of different family and work related obligations. This will most definitely make the list as well as caching keyed delegates but I just can't start the work now. |
@eglauko I think this solution will work for the moment and for 7 I'll remove the interface and add the object key parameter to |
Yes, I understood what you wanted to do and I created a solution to solve this problem without creating any impact on the current version. I thought you could create another cache in the BaseExportLocatorScope class, similar to the ActivationDelegates cache, for delegates with type and key. And in the locate method of the InjectionScope class you could create and search for these keyed delegates. |
Could you release a preview version with this PR? |
I can do that this evening. |
100% of my tests passed. |
I'm pushing out a release this evening for this. Glad it worked out |
I have a class named OptionalWrapperStrategy (for Optional) extending BaseWrapperStrategy, and implementing IMissingExportStrategyProvider, IMissingDependencyExpressionProvider.
I can inject Optional with keys in properties, construtor parameters, and methods parameters.
If i try locate Optional using ILocatorService.Locate works fine, but if i try use 'withKey' an exception is thrown, and the methods of OptionalWrapperStrategy are not called.
The text was updated successfully, but these errors were encountered: