I've got numerous taks objects derived from a base Task object that have a DoWork() function that returns a TaskStatus. Additionally, the DoWork() function should ALWAYS set the classes Status property to it's output value.
Pattern-wise, I want to figure out how to cleanly ensure that the last lines of each subclasses' overridden DoWork() function always sets the object's Status property.
I'm failing to come up with anything workable (other than simply writing the lines to do that at the end of each overridden function, which is just Hope-you-and-all-future-maintainers-remember-to-copy-and-paste-it-into-every-derivative function)
Any patterns that can handle it that I'm missing?
Pattern-wise, I want to figure out how to cleanly ensure that the last lines of each subclasses' overridden DoWork() function always sets the object's Status property.
I'm failing to come up with anything workable (other than simply writing the lines to do that at the end of each overridden function, which is just Hope-you-and-all-future-maintainers-remember-to-copy-and-paste-it-into-every-derivative function)
Any patterns that can handle it that I'm missing?