views:

19

answers:

1

We have a project that was implemented in linq to sql and is being migrated to LLBLGenPro runtime using the adapter pattern.

The first version of the app did a huge amount of caching, placing entire tables into the httpcache and then doing all the linking in the codebehind. (sigh)

So you get something like :

from p in MyCacheObject.ProductPages
join cmpp in MyCacheObject.ProductContentMemberships on p.ProductPageId equals cmpp.ProductContentId
join pl in MyCacheObject.ProductPlans on cmpp.ProductLinkId equals pl.ProductPlanId                         

Now, in our new repository pattern, I can build such joins with prefetch paths. You just call myRepository.GetProductPagesWithContentMemberships() and get a ProductPage entity with a collection of ProductContentMemberships.

That's great when we are talking to the db, but how do I sometimes pull from a collection of cached entities? I want to cache the tables and then use them to build my complex objects.

I can make "get from cache" vs "get from db" a decision that the repo can make, but I'm hoping I don't have to write two entirely different implementations of GetProductPagesWithContentMemberships(): one to get from db and one to use the cache.

I'm hoping there is some kind of magic adapter that I can use that will execute my linq against an object cache instead of sending it to SQL server. Is there such a thing?

This post: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=6265 hints that it is possible, but that's it.

A: 

The short answer, I'm afraid, is "No"- there is no magic adapter that will do the caching for you, and LLBLGen does not support any form of caching other than using the Context object - but these are local to a user and session, and not global.

Article by Frans Bouma about caching in ORM Mappers

Matt
Yeah, I guess that's the answer. I was hoping that it would be easy to hook a custom adapter up to an object collection. I suspect it is still possible, if I want to overload the adapter myself, but that's probably out of scope.
brian b