Caching with Context object

Posts   
 
    
KIT
User
Posts: 59
Joined: 04-Apr-2007
# Posted on: 04-Apr-2007 12:17:43   

Hello..

I want to use the Context object as a Cache (I guess that is what it is intended for). So I implemented the following lines of code:


        xxxEntity o = new xxxEntity(id);
        mAdapter.FetchEntity(o, ApplicationCache.Instance.Context);

(ApplicationCache = Singleton class)

From my understanding this should fetch the object from the cache if it has been already fetched before. However, checking the executed SQL statements in the profiler tells me that it is fetched again and again.

Why? Is my code wrong or is there another misunderstanding?

Thank you in advance for your help!

Cheers, Brad

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 04-Apr-2007 16:28:08   

I want to use the Context object as a Cache (I guess that is what it is intended for)

No, it was not intended to act as a cache, it's main purpose is to be a uniquing feature.

Please check the LLBLGen Pro manual: "Using the generated code -> Adapter -> Using the context", to know how to use the LLBLGen Pro Context object.

KIT
User
Posts: 59
Joined: 04-Apr-2007
# Posted on: 05-Apr-2007 09:10:38   

Ok I understand. I will implement the caching in another way. Thanks a lot for your feedback.