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

GetEntityGraph

 Post Reply Post Reply
Author
Customer View Drop Down
Senior Member
Senior Member
Avatar
User Submitted Questions to Support

Joined: 30-May-2007
Location: United States
Posts: 260
Post Options Post Options   Quote Customer Quote  Post ReplyReply Direct Link To This Post Topic: GetEntityGraph
    Posted: 06-Jun-2007 at 12:25pm

Question:

I want to save changes to a particular set of objects (e.g., Employees whose LastName starts with “G”) and all of their related objects (e.g., Orders, OrderDetails, Customers, Products, Shippers, and Suppliers) . Or maybe I want to copy that set of objects and related objects into a separate PersistenceManager. Is there an easy way to collect that set of objects into a single list?

Includes several test cases for a variety of scenarios: 1 root 1 span, 2 roots 1 spans, 2 roots 2 spans, etc.



Edited by Customer - 06-Jun-2007 at 12:27pm
Back to Top
IdeaBlade View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 30-May-2007
Location: United States
Posts: 353
Post Options Post Options   Quote IdeaBlade Quote  Post ReplyReply Direct Link To This Post Posted: 06-Jun-2007 at 12:25pm

Answer:

There is now (as of DevForce version 3.4.0). GetEntityGraph (a new method on the PM) will enable you to obtain a collection of the entire graphs of specified entities, which collection can then be saved, or imported from one PM to another. GetEntityGraph only works with entities in the cache.

This is the signature:

 

    /// <summary>

    /// Given any entity or entities in a graph, collects and retrieves all

    /// related entities in the graph. This is a cache-only operation.

    /// </summary>

    /// <param name="pEntityRoots">A list of entities used as the starting point for retrieving all other related entities</param>

    /// <param name="pEntitySpans">One or more <see cref="EntitySpan"/>s</param>

    /// <param name="pRowState">RowState of entities to return</param>

    /// <returns>A list of related Entities</returns>

    /// <exception cref="ArgumentNullException">Thrown if pEntityRoots and/or pEntitySpans is null.</exception>

    /// <exception cref="ArgumentException">Thrown if the type in a span does not have a matching type in one of the roots.</exception>

    public EntityList<Entity> GetEntityGraph(

      IEnumerable<Entity> pEntityRoots,

      IEnumerable<EntitySpan> pEntitySpans,

      DataRowState pRowState)

 

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down