Skip to content
This repository has been archived by the owner on Jul 27, 2021. It is now read-only.

Store Action Handler Lookup #5

Closed
5 tasks done
Andrei15193 opened this issue Jun 4, 2019 · 0 comments
Closed
5 tasks done

Store Action Handler Lookup #5

Andrei15193 opened this issue Jun 4, 2019 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Andrei15193
Copy link
Owner

Andrei15193 commented Jun 4, 2019

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
@Andrei15193 Andrei15193 added the bug Something isn't working label Jun 4, 2019
@Andrei15193 Andrei15193 self-assigned this Jun 4, 2019
Andrei15193 added a commit that referenced this issue Jun 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant