Print Page | Close Window

Data Caching

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=747
Printed Date: 25-Apr-2024 at 7:25am


Topic: Data Caching
Posted By: danielp37
Subject: Data Caching
Date Posted: 27-Mar-2008 at 10:02pm
I have a query like this:
 

var member = dataset.ExecuteQueryForEntity<Member>((from mem in dataset.Members

    where mem.MemberId == "754402"

    select mem));

 
and then I iterate through the Member's ActualCoverages collection and access the ActualCoverage's CoverageIntent link (CoverageIntent is a table that ActualCoverage links to).  For Example:

foreach(var ac in member.ActualCoverages)

{

    if(!ac.CoverageIntent.IsNullEntity)

    {

         if(!ac.CoverageIntent.Employer.IsNullEntity)

              Console.WriteLine(ac.CoverageIntent.Employer.EmployerName);

    }

}

 
Several of the ActualCoverages link to the same CoverageIntent (3478c) and I was expecting that the first time that the CoverageIntent is accessed, it would need to go to the DB, but then subsequent requests would get it from the cache because even though we are accessing the CoverageIntent from different ActualCoverages, it is the same coverageintent and should already be in the local cache.
 
Am I doing something wrong?  I can see in the Trace Viewer that the same query is getting called over and over trying to get the same CoverageIntent.
 
Thanks,
 
Dan



Replies:
Posted By: kimj
Date Posted: 08-Apr-2008 at 11:38am
Sorry for the late reply.
 
No, you're not doing anything wrong.  It looks like we've got a bug in our handling of relational properties.  In this case, since we've seen the EntityKey for CoverageIntent before, it should be in the QueryCache and we should therefore look in the EntityCache for the entity, and not go to the database. 
 
Thanks for pointing this out.  I've opened a bug report for this issue.



Print Page | Close Window