This is a migrated thread and some comments may be shown as answers.

FetchPlan and ObjectContainer?

4 Answers 57 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
shawn reagan
Top achievements
Rank 1
shawn reagan asked on 11 Jul 2010, 08:06 PM
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.

4 Answers, 1 is accepted

Sort by
0
shawn reagan
Top achievements
Rank 1
answered on 11 Jul 2010, 08:09 PM
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()

 

 

 

 

 

0
Serge
Telerik team
answered on 14 Jul 2010, 05:47 PM
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
0
shawn reagan
Top achievements
Rank 1
answered on 15 Jul 2010, 02:41 AM
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.
0
Serge
Telerik team
answered on 15 Jul 2010, 05:03 PM
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
Tags
General Discussions
Asked by
shawn reagan
Top achievements
Rank 1
Answers by
shawn reagan
Top achievements
Rank 1
Serge
Telerik team
Share this question
or