FetchPlan and ObjectContainer?

Thread is closed for posting
5 posts, 0 answers
  1. shawn reagan
    shawn reagan avatar
    14 posts
    Member since:
    Feb 2010

    Posted 11 Jul 2010 Link to this post

    Hello,
    I have currently setup a FetchPlan for one of my ORM classes.  This seems to work fine. When looking at the SQL profiler it is only querying the fields that are part of the FetchPlan.

    We are also using the ObjectContainer.CopyFrom and using our ObjectScope.  When the CopyFrom is executed it doesn't appear to be using the FetchPlan anymore.

    Is it possible to use a FetchPlan when using the ObjectContainer.

    Thanks for any help.
  2. shawn reagan
    shawn reagan avatar
    14 posts
    Member since:
    Feb 2010

    Posted 11 Jul 2010 Link to this post

    Dim container As New ObjectContainer
    Dim fgCollector As New FetchGroupCollector("testFetchPlan")
      
    scope.Transaction.Begin()
    scope.FetchPlan.Clear()
    scope.FetchPlan.Set("testFetchPlan")
      
    Dim query = scope.Extent(Of MyObject)().ToList 'This looks like it uses the fetchplan correctly
      
    container.CopyFrom(scope, "TestList", query, fgCollector) 'This doesn't look like it uses the fetchplan
    scope.Transaction.Commit()
    scope.Dispose()

     

     

     

     

     

  3. Serge
    Admin
    Serge avatar
    375 posts

    Posted 14 Jul 2010 Link to this post

    Hi Chawn Reagan,

    If you are referring to primitive members of the classes and not navigational ones then this is expected behavior. The object container is populated with all primitive members of the object. The point here is that if the fetch group contains a navigational property that points to another object (or collection), that object will be also fetched. It will not however filter on any primitive properties. You will always fetch them and have them in the container.

    It is in fact possible to use fetch plans with the object container using the approach you have described, but only for specifying extra fields to be loaded, you always get the primitive members of the object.

    I hope this helps.

    Regards,
    Serge
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  4. shawn reagan
    shawn reagan avatar
    14 posts
    Member since:
    Feb 2010

    Posted 14 Jul 2010 Link to this post

    Thanks for the reply.  Some of that was a bit over my head, but I'll experiment with it a bit.  I think you've given me enough to figure it out. :)

    I appreciate the detailed response.

    Thank you.
  5. Serge
    Admin
    Serge avatar
    375 posts

    Posted 15 Jul 2010 Link to this post

    Hello Shawn Reagan,

     I am glad I have been of help, please do not hesitate to contact us back if you find yourself in trouble or need more information.

    Best wishes,
    Serge
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top