I'm thinking which way to go and can't decide which one is better. Maybe you can give me the killer idea :)
My problem: I have a generic repository built on top of NHibernate. It's interface is very simple, such as Get(object id), Save, Delete etc. Sometime this interface works fine, but sometime it doesn't. For example, several entities in my project has a property named Code (but not all). I want to be able to get an entity not only by primary key, but also with this property. Another situation is when I need to filter some entities with dates, or provide other filtering criteria which are specific to individual entities. Currently I'm thinking of the following solutions:
I prefer entity-specific repositories, after putting a lot of effort into generic repositories.
This answer of mine (36 votes so far) elaborates on this stance and contains an approach you might be able to use:
Advantage of creating a generic repository vs. specific repository for each object?
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