views:

65

answers:

1

I have a table that is storing a list of rules. In my code, I need to retrieve those rules and maintain the list of rules (via. the Repository Pattern) so that I can reuse them. I then need to generate(business logic) a list of objects based on the rules for a particular period of time, eg, a list of holiday objects filtered by the rules from the database that are coming in the next 6 months, then if I require a further 6 months, I will need to concatenate the values of the following 6 months to the existing holiday objects list based on the retrieved rules.

The list of holiday objects are translated/created based on the rules for the given period.

My Question is, should the business rules to store/translate the list of holiday objects be sitting inside the same repository as the list of rules? Or should it be a class that calls the repository, but I would still want to maintain the list of translated holiday objects items.

Thanks

+3  A: 

In my mind, a repository is purely about retrieving and storing information from a database and should be kept as pure as possible. I'd recommend putting the business logic in the classes that call the repository...your layers will be kept separate which will allow for easier reuse of the repository.

See these nice articles about the repository pattern.

mezoid