I need to provide a means to perform validation on a booking system. This validation needs to act as a type of service. It will initially be simple, but will change as usage patterns emerge in the system that we wish to deal with and validate against. The validation process will be the same for every booking, but the process itself may change each week or month depending on the business. ie. We need an easy way to update the validation periodically. Eventually the fluidity will subside but initially it could be quite high.
I have written a proof of concept that uses windows workflow which I think is going to work out nicely. I define a workflow that performs the validation in a separate assembly. The workflow uses a base class that contains a property which holds the meta data upon which to validate the booking against. This will act as a common point to provide the data upon which to validate.
The validation is created using the workflow designer and is serialized as XOML (Workflow specific XAML) and saved to a database (just a simple string). The assembly is shipped with the system. The validation API loads the current XOML definition from the database and instantiates a workflow from it (de-serializes the XOML), then populates the meta data properties so the workflow can do its thing. We kick off the activity and get a notification about success or failure (and appropriate reason if failure).
When I need to change the validation, I define a new one using the workflow designer (same assembly or a new one...doesn't matter), serialize it and store it in the DB (using a really basic utility app. new validation is now used when the next booking is performed.
I'll post some code when I get a nicer API around it going and the code a lot neater. Right now it is very dirty and just proves the technical concept. Now I can move forward with a neater solution to encapsulate this within our current solution.
Just thought I'd share for comment. Works well in the POC. Actual implementation may be different....