TruffleMuffin/Decisions

Service CheckMany should return the input contexts as dictionary keys

Opened this issue · 2 comments

At the moment you need to know the internals of decision context or make a best guess to match the contexts you provided against the keys in the output dictionary. The keys should be the contexts so you can do object equality lookups (so don't return an identical copy of the context!).

Could include the 'key' string as a property of the context if you want to resolve this somewhat without requiring a major version bump I guess, but it's not really the best solution.

Logged as a bug instead of an enhancement, because I feel it makes usage of the CheckMany function risky, and could well be the cause of bugs from difficulty in safely using it.

I think it can be handled without a Major version bump by simply making DecisionContext implicitly castable to a string. Map that string to be the DecisionContext.Id. That should prevent build errors on update.

Seems okay, but not sure if ID is a logical name for this property in it.

Ensure you have an implicit constructor for reversal, and set a constraint that a context can never include additional information not put into this string?

Ensure ToString is also set correctly? (can't be bothered to check this moment)