Search This Blog

Wednesday, June 24, 2009

Repositories And Abstract Classes

Ran into weird problem where my Aggregate Root was an abstract type with many concrete classes. Should I have one Repository for each concrete class or one Repository for the base class?

I couldn't find anything in the big blue book or online so I made something up. I have one Repository for the base class. Then each GetByXXX method is a generic method that takes the type of objects you expect to get returned. So you can get a list of the base classes or a concrete type or an interface that allows you to group concrete types together.

No comments:

Post a Comment