Print Page | Close Window

Finding an object Graph with CodeFirst

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3556
Printed Date: 13-May-2026 at 2:59am


Topic: Finding an object Graph with CodeFirst
Posted By: rbautistaole
Subject: Finding an object Graph with CodeFirst
Date 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 - http://drc.ideablade.com/xwiki/bin/view/Documentation/query-working-in-cache  when i using code first?.
 
thanks



Replies:
Posted By: sbelini
Date 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.
 
 


Posted By: rbautistaole
Date 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.
 


Posted By: sbelini
Date 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.


Posted By: rbautistaole
Date Posted: 31-Jul-2012 at 11:09am
Ok, thanks. I think that the documentation is poor in this topic.



Print Page | Close Window