I have a scenario where I need to assign some Items to a Guest.
GuestTable has columns like
1. Guest ID
2. GuestType
3. Age
4. Height
5. Gender
ItemTable has columns like
1. ItemID
2. Item Name
Every item is sold to guest based on item's availability as well as attributes of guest i.e. Age Group or Height range etc.
eg. An item is available every Monday and Tuesday from 2-4 PM and 6-8 PM for Male Spa guest as well as Hotel Guest having height greater than 5" and less than 5'5".
Since number of filter conditions are large and configurable by end user. As well as system should be scalable enough to accommodate new filter criteria, How should I manage these rules. Is it OK to store these rules as expression in database tables? How to model the database tables for this scenario?
OR
Should I consider using some rule engine for it?
As APC writes in the comment, deciding on whether to use a business rules engine is not something you should trust to a bunch of strangers on the internet.
However...your scenario is relatively straightforward and constrained. It appears to be a single step, rather than a workflow - "if customer meets criteria x, offer product y", rather than "all customers matching criteria x must be approved by a manager". It appears to be constrained to just the database - no invoking web services to decide whether a product is suitable.
On that basis - no, don't go for a rules engine. They're big, complicated machines that only pay for themselves in far larger problems than the one you describe.
I'd suggest using a .Net "query by example" library to allow your users to create the filter conditions; there are several commercial options, such as EasyQuery.
You should think about using something like Flee and avoid using the database as a rules engine. Client side parsing will be much faster and will not put as much load on you database server. Just read in the values and then parse the expression using Flee
. It a great evaluation engine. Try and let us know what you think.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With