New Posts New Posts RSS Feed: Finding an object Graph with CodeFirst
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Finding an object Graph with CodeFirst

 Post Reply Post Reply
Author
rbautistaole View Drop Down
Newbie
Newbie


Joined: 01-Apr-2011
Posts: 37
Post Options Post Options   Quote rbautistaole Quote  Post ReplyReply Direct Link To This Post Topic: Finding an object Graph with CodeFirst
    Posted: 27-Jul-2012 at 8:39pm
Hi.
How can i Findi an object graph such as explained in http://drc.ideablade.com/xwiki/bin/view/Documentation/query-working-in-cache when i using code first?.
 
thanks
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 31-Jul-2012 at 9:42am
Hi rbatistaole,
 
The graph on Code First entities should be about the same, but you'd be getting the EntityRelations from the MetadataStore.
 
Can you explain what exactly is the problem you are having?
 
Silvio.
 
 
Back to Top
rbautistaole View Drop Down
Newbie
Newbie


Joined: 01-Apr-2011
Posts: 37
Post Options Post Options   Quote rbautistaole Quote  Post ReplyReply Direct Link To This Post Posted: 31-Jul-2012 at 9:51am
No problem really. Instead i need to make use of the Manager.FindEntityGraph since the EntityRelations in the example was generated for the edmx. In code first how I get these relations?
thanks.
 


Edited by rbautistaole - 31-Jul-2012 at 9:52am
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 31-Jul-2012 at 10:47am
Like mentioned previously, using the MetadataStore:
i.e.
 
var span1 = new EntitySpan(typeof(Employee), EntityRelations.FK_Order_Employee, EntityRelations.FK_OrderDetail_Order);
 
var span1 = new EntitySpan(typeof(Employee), EntityMetadataStore.Instance.GetEntityRelation(typeof(Employee), Employee.EntityPropertyNames.Orders), EntityMetadataStore.Instance.GetEntityRelation(typeof(Order), Order.EntityPropertyNames.OrderDetails));
 
 
Silvio.
Back to Top
rbautistaole View Drop Down
Newbie
Newbie


Joined: 01-Apr-2011
Posts: 37
Post Options Post Options   Quote rbautistaole Quote  Post ReplyReply Direct Link To This Post Posted: 31-Jul-2012 at 11:09am
Ok, thanks. I think that the documentation is poor in this topic.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down