Loading Strategy for Entity Framework 4.0

Published Sunday, July 25, 2010 12:23 PM by Fredrik N
Filed under:

Comments

# re: Loading Strategy for Entity Framework 4.0

Sunday, July 25, 2010 6:49 AM by Cengiz Han

Hi Fredrik,

What is the minus point of inheriting from generic repository for specific repositories?

# re: Loading Strategy for Entity Framework 4.0

Sunday, July 25, 2010 7:06 AM by Cengiz Han

-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.

# Twitter Trackbacks for Loading Strategy for Entity Framework 4.0 - Fredrik Norm??n [asp.net] on Topsy.com

Pingback from  Twitter Trackbacks for                 Loading Strategy for Entity Framework 4.0 - Fredrik Norm??n         [asp.net]        on Topsy.com

# Dew Drop – July 26, 2010 | Alvin Ashcraft's Morning Dew

Pingback from  Dew Drop – July 26, 2010 | Alvin Ashcraft's Morning Dew

# re: Loading Strategy for Entity Framework 4.0

Tuesday, July 27, 2010 3:34 AM by Stefan Holmberg

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 ?

# re: Loading Strategy for Entity Framework 4.0

Tuesday, July 27, 2010 4:37 AM by Fredrik N

@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 ;)

Leave a Comment

(required) 
(required) 
(optional)
(required)