Closed eValker closed 6 months ago
Hi @eValker, thank you for reporting this issue! I'm going to work on a way to let users disable this feature easier.
Hi @eValker, I've released a new version v5.14.0
where you can disable the required
member injection with the .WithRequiredMemberInjection(enabled: false)
container or registration configuration option.
Let me know if you have further issues or questions!
This issue is marked stale because it has been open for 90 days with no activity.
This issue was closed due to no activity.
Hello,
I have upgraded Stashbox to version v5.13.0, and I immediately noticed a breaking change related to the auto-injecting of required members feature. I understand the intention, but I am not sure this is the best approach, especially since this is default behavior.
Let's have a look at the example code below:
Before 5.13, it was working ok - you have to add an attribute to the property in order to make the container automatically inject it. However, starting with version 5.13, the container is now invalid because of SimpleTypeProperty. While trying to validate the container, I am getting an error:
I understand that my case is very specific, and most of the users will not be affected. However, I think you should add a way to disable this change (on a global level and also on a type level with an attribute or something).
For now, the only way to disable it is to use the
WithAutoMemberInjection
setting with a filter specified. Also, disabling it with the enabled option (WithAutoMemberInjection(enabled: false)
) is not working; it will still try to auto-inject value into the property.Valker