New Posts New Posts RSS Feed: EntityReferenceLoadStrategy
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

EntityReferenceLoadStrategy

 Post Reply Post Reply
Author
bfoster View Drop Down
Newbie
Newbie


Joined: 29-Jan-2010
Posts: 1
Post Options Post Options   Quote bfoster Quote  Post ReplyReply Direct Link To This Post Topic: EntityReferenceLoadStrategy
    Posted: 04-Feb-2010 at 11:37am

I am evaluating DevForce and do not like the idea of the "Getter" automatically loading navigation properties.  I would like to use EntityReferenceLoadStrategy.DoNotLoad and implement my own explicit lazy loading.  However it looks like I would need to change the FetchStrategy to CacheOnly which obviously would not be very usefull. 

Would the world exlpode if I set the load strategy directly (via reflection), or must I resort to code gen?
 
Thanks!
Back to Top
GregD View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post Posted: 05-Feb-2010 at 2:26pm
There are two approaches you can use:

1)     
The EntityReferenceStrategy can be set for a property via the EntityRelationRole via the static EntityRelations defined for each type.  This effects all navigation on this property.
a.  EntityRelations.FK_OrderSummary_Customer.Role1.ReferenceStrategy = EntityReferenceStrategy.NoLoad;
b.  EntityRelations.FK_OrderSummary_Customer.Roles.First(er => er.EntityType ==
   typeof(Customer)).ReferenceStrategy = EntityReferenceStrategy.NoLoad;

2)      You can set the EntityManager.DefaultQueryStrategy = QueryStrategy.CacheOnly
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down