• Hi Fredrik,
    What is the minus point of inheriting from generic repository for specific repositories?

  • -as we speak from the twitter- I aggree, using strategies for nongeneric methods can be better if there isn't a lot of nongeneric method needs, otherwise creating strategies for all nongenerics queries can be mess.

    thanks for good post.

  • Fredrik, I bet you already know this, but another similar pattern is Specification.
    Works the same as for specifying and abstracting the "where" clause so to speak but since it also typically (??? - at least mine do) have a IsSatisfiedBy(TEntity obj) it makes it useful to be reused in the entity class as well - to check if a (already loaded) specific object instance meets the requirements of the expression.

    However I have it (specification that is) work only to encapsulate the expression - and you in your example have the strategy work against the ObjectSet - which I guess is what makes it a "strategy" - meaning you can as well specify objectSet.Include("Tags") = *loading* strategy

    I dont do EF anymore, but focus on NHibernate , AND am no expert in patterns etc, but is my guess above somewhat correct ?

  • @Stefan:
    I have created a ISpecification<TEntity> for nHibernate.. but the implementation is more than a specification, is aslo a loading strategy, so now when I made the same kind of impl. to EF 4.0, I decided to call it Loading Strategy instead, think that name is much better. About ObjectSet.Include = loading strategy, yes, that's why I call it loading strategy.
    Btw, would be perfect discussion on ForkCan.com ;)

Comments have been disabled for this content.