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

[Solved] Fetch Plan does not work

2 Answers 78 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.
Burkhard
Top achievements
Rank 1
Burkhard asked on 16 Dec 2010, 07:30 PM

Hello,

I'm trying to get performance improvement using FetchGroup/FetchPlan by avoiding to get a huge byte[] from the DB.
I've defined a fetchGroup in my BO as shown below:

 

[Telerik.OpenAccess.

Persistent(IdentityField="mathKernelId")]
public partial class MathKernel
{
[

FetchField("WithoutMathCode")]
private long mathKernelId; // pk

private
byte[] mathCode;

[
FetchField("WithoutMathCode")]
private string mathKernelName;

[
FetchField("WithoutMathCode")]
private string mathKernelVersion;

[
FetchField("WithoutMathCode")]
private DateTime? modifiedAt;
}

I used the fetchplan browser to generate the FetchPlans class

 

 

public class FetchPlans
{
    public static FetchPlan MathKernelWithoutMathCodePlan =
    new FetchPlan
    new string[] { "WithoutMathCode"}, 
    FetchPlan.DefaultMaxDepth,
    FetchPlan.NoLimit ) ;
}

When I try to use this fetch plan, it seems to be ignored and I get the complete object including the byte array on "mathCode"

 

scope.FetchPlan =

FetchPlans.MathKernelWithoutMathCodePlan;
scope.FetchPlan.Add(
"WithoutMathCode");
var result = from o in scope.Extent<MathKernel>()
select o;

When I examine the scope.FetchPlan I cannot see any change after the scope.FetchPlan = FetchPlans.MathKernelWithoutMathCodePlan;
statement. It seems as this statement is ignored.

I also tried
scope.FetchPlan.Clear();
scope.FetchPlan.Add("WithoutMathCode");
Same result.

Do you have a hint?

Regards,
    Burkhard

PS. I'm using Telerik.OpenAccess for .NET 2.0: 2009.1.405.1

 

2 Answers, 1 is accepted

Sort by
0
Burkhard
Top achievements
Rank 1
answered on 17 Dec 2010, 01:28 PM
Sorry, the fetch plan works well as I can see, when I examin the SQL that is going to the DB, I can see that the query does not include the "math code" column: The "math code" property is lazy lodaded with an other SQL when I examine the property with the debugger or copy the objects to a container.
It is possible to avoid this lazy loading and fill the container with just the objects I've got in the first query and leave the "math code" property null?

0
Ady
Telerik team
answered on 20 Dec 2010, 05:39 PM
Hi Burkhard,

 It is not possible to have partially filled instances in the container. All the fields are fetched while filling the container.

Regards,
Ady
the Telerik team
Accelerate your learning with industry's first Telerik OpenAccess ORM SDK. Download today.
Tags
General Discussions
Asked by
Burkhard
Top achievements
Rank 1
Answers by
Burkhard
Top achievements
Rank 1
Ady
Telerik team
Share this question
or