I have a Visual Studio Solution which has a bunch of Projects in it. One of these projects is called Services and is basically the junction point between all remaining projects. When I built it originally I made it as generic as possible so I can expand on it. At the time I only had to work with Entity Framework backed implementations of it, but now I've added QuickBooks to the mix as well. It mostly worked out well, but I saw the need to refactor and redesign bits and pieces of it. To that end I've spent most of yesterday doing that and I have new code that takes care of the weirdness I had before, but, I find myself using lots of interfaces and lots of inheritance and I'm not exactly comfortable with it. For example here's my DbService implementations:public class DbService<TEntity> :    Service<TRepository>,    IDbQueryableService<TEntity>,    IQueryableService<TEntity> {}public class DbService<TEntity, TKey> :    DbService<TEntity>,    IDbGettableService<TEntity>,    IGettableService<TEntity, TKey>,    IRemovableService<TEntity, TKey>,    IRestorableService<TEntity, TKey> {}public class DbService<TEntity, TEntityFormItem, TKey> :    DbService<TEntity, TKey>,    IAddableService<TEntityFormItem, TKey>,    IUpdatableService<TEntityFormItem, TKey> {}public class DbService<TEntity, TEntityFormItem, TEntityListItem, TKey> :    DbService<TEntity, TEntityFormItem, TKey>,    IDbListableService<TEntityListItem>,    IListableService<TEntityListItem> {}public class DbService<TEntity, TEntityFormItem, TEntityListItem, TEntitySelectItem, TKey> :    DbService<TEntity, TEntityFormItem, TEntityListItem, TKey>,    IDbSelectableService<TEntitySelectItem>,    ISelectableService<TEntitySelectItem> {}This is very similar to my current code and allows me to only inherit from a base class that has the functionality I want. For example, if a TEntity can be listed, but doesn't need to be displayed as a select list, then I'll inherit from the fourth DbService. This way I know I can upgrade or downgrade my inheritance as I need to. That being said, it itself has a lot of inheritance between base classes and interfaces. There's six levels of base class inheritance and 12 interfaces.So, this morning I tried to bring it all together a little bit and came up with this:public class DbService2<TEntity, TEntityListItem, TEntitySelectItem, TKey> :    Service<TRepository>,    IDbReadableService<TEntity, TEntityListItem, TEntitySelectItem>,    IReadableService<TEntity, TEntityListItem, TEntitySelectItem, TKey> {}public class DbService2<TEntity, TEntityFormItem, TEntityListItem, TEntitySelectItem, TKey> :    DbService2<TEntity, TEntityListItem, TEntitySelectItem, TKey>,    IWritableService<TEntity, TEntityFormItem, TKey> {}Now this version obviously reduces the depth of inheritance on the base classes to three and the interfaces to three, but, it forces me in a position where some inheriting TEntity services will not be using all of the features so I'd have to use placeholders to fill in some of the TEntity* parameters and that feels like it will end up dirtier in the long run than the first code sample.Also, I do realize that I'm using lots of generic parameters, but it works for my needs and this not being a publicly exposed API, I'm OK with it.So, my question for you fine folks is, am I being too zealous in trying to reduce the base class and interface inheritances or am I OK to continue as is, which has worked so far (referring to the original code I was refactoring which is very close to the first example)? Visual Studio gives the first example a maintainability index of 86.5% (average), and 82.5% (average) for the second example, so if I follow VS assessment, I should continue with the first example?
Many interfaces and lots of inheritance vs few interfaces and less inheritance?
c#;generics;inheritance;interface