Example proposal for Issue #731#1185
Example proposal for Issue #731#1185dburriss wants to merge 2 commits intoCompositionalIT:masterfrom
Conversation
|
Thanks @dburriss! I like this approach 🙂 Particularly because it's a very simple change that is backwards compatible. It will only work for simple on/off cases and not those where we need to pass in more complex data, but is definitely a good idea for them. As you say, it's potentially quite a lot of work, but would be fairly easy to apply in increments - there's no need to change every Farmer CE in one PR. If you'd like to raise a PR(s) for the cases that you need (or more!), I'm sure that we'll be happy to merge them 🙂 |
|
@mattgallagher92 Ok nice. As I mentioned, I have a usage where I will likely need this flexibility on a couple of resources, so I will make the changes on the CEs for all boolean switches as needed (I will do all on a CE, not just the ones I need ;) ) |
This is linked to the issue described in #731 and is just for demo purposes.
I have encountered this issue a few times with Farmer and do not know of an elegant solution.
Something like this can get you out in a pinch but it requires knowing what the builder is setting, which leaks the details. It's also just not very elegant.
An elegant solution would be if we could implement
ForandZeroin a way that allowed forifin the CE but playing around with it for a few minutes did not work as expected. I have not worked with CEs for a while but not sure if this is even possible for a non-collection based CE.A simple solution (albeit quite some work) is to take in a value but add an optional parameter.
This matches what I usually do in builders in C# where boolean switching takes in a boolean with a default value.