You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 27, 2021. It is now read-only.
For version 2 only public methods will be looked up to handle store changes. Initially it seemed like a good idea to have all methods that take an ActionData parameter mapped as action handler regardless if they are public or not.
This is somewhat odd because we can do this with reflection, but we cannot do it normally (as in writing code that makes the actual call). The general guideline should be that if we can do something as if we were to write actual code then it should be alright to do generalise some boilerplate code using reflection. In this case, mapping action handlers using reflection should only work for action handlers we can call outside the assembly (public members only).
Going through reflection when otherwise it is not possible is more of a hack than an actual implementation (risking reflection abuse even). We can set private fields through reflection, does that mean we should be doing it or that it is alright?
While this will expose the methods that handle actions they will not be visible in XAML as only properties will be visible. In order to avoid "accidentally" calling the handler one can define an interface for the store that only exposes the data properties, this can help with unit testing as well as interfaces can be mocked by default (in case UI components need to be unit tested, this is unlikely as unit testable logic in the UI is a code smell and should either be moved elsewhere or is an edge case).
This needs to be done for Version 1 as well, only public methods need to be considered as action handlers by default. This behaviour can be overridden at any point and include non public methods as well.
Updated action handler lookup
Update documentation in code
Update documentation on site
Update release notes
Release version 1.0.1
The text was updated successfully, but these errors were encountered:
For version 2 only public methods will be looked up to handle store changes. Initially it seemed like a good idea to have all methods that take an
ActionData
parameter mapped as action handler regardless if they are public or not.This is somewhat odd because we can do this with reflection, but we cannot do it normally (as in writing code that makes the actual call). The general guideline should be that if we can do something as if we were to write actual code then it should be alright to do generalise some boilerplate code using reflection. In this case, mapping action handlers using reflection should only work for action handlers we can call outside the assembly (public members only).
Going through reflection when otherwise it is not possible is more of a hack than an actual implementation (risking reflection abuse even). We can set private fields through reflection, does that mean we should be doing it or that it is alright?
While this will expose the methods that handle actions they will not be visible in XAML as only properties will be visible. In order to avoid "accidentally" calling the handler one can define an interface for the store that only exposes the data properties, this can help with unit testing as well as interfaces can be mocked by default (in case UI components need to be unit tested, this is unlikely as unit testable logic in the UI is a code smell and should either be moved elsewhere or is an edge case).
This needs to be done for Version 1 as well, only public methods need to be considered as action handlers by default. This behaviour can be overridden at any point and include non public methods as well.
The text was updated successfully, but these errors were encountered: