Hello all.
I was recently tasked with creating a service interceptor that would prevent an individual from being put into a household if they have a "Void Household Operations" attribute. Along the way, I discovered that there are three (that I know of) ways* an individual could be put into a household, so I wrote three interceptors to cover them.
My question is this: Should I try to combine the three into one?
My initial instinct is to leave them separate. Each has a different UriMatch to watch for, so I could combine them and check if ((UriMatch1 and {other tests}) or (UriMatch2 and {slightly different tests}) or (UriMatch3 and {still other tests})) then throw an exception and log it. But I feel like that will get clunky quickly, and it could be tough to pick through down the road if I need to update or fix it.
Then again, I'm new to .Net/C# programming, so I don't know if there are other factors I'm not taking into consideration. Is there a reason why one big interceptor would be preferable to three smaller ones?
Thanks!
Nathan
*The ways I know of are:
1) From the individual's constituent record, click Constituents -> Household Operations -> Convert to Household
2) From a household constituent record, click the "Add Affiliate" button, and provide the individual's information
3) Create a new household, and use the individual as Affiliate 1
Nathan,
One thing you could do is have your three plugin classes, but put the shared in a separate library minimizing the code in the plugin class.
Jon
Jon,
I see what you mean. Thanks!