Sharing methods across 2 service levels
I am developing an application with MVC3 and Entity Framework. I have service levels for two entities that share the same similarity.
The two services are DurationService and FieldService. The first one processes a list of days and days. These settings contain information about the time slots per day (start time, end time, list of possible break times). The latter service processes the list of fields and field settings. These field settings are used to determine the availability of a field.
Both services should check if the break times overlap. I coded this for DurationService but now noticed that FieldService requires exactly the same method. I don't want to break the DRY principle, so my question is, how do I best deal with this?
Can I create a static class that both services can call? Am I using some kind of inheritance (although this method is the only method they will use).
source to share