简体   繁体   中英

LLBLGen Pro 5.0 caching with EntityCollectionBase.GetMulti()

I'm using LLBLGen 5.0 and EntityCollectionBase.GetMulti(filter, relation) to retrieve objects in oracle database.

ObjectCollection objects = new ObjectCollection ();
RelationCollection relationsToUse = new RelationCollection();
relationsToUse.Add(ObjectEntity.Relations.Object2EntityUsingObject2Id);
IPredicateExpression filter = new PredicateExpression(ObjectFields.Code == sectionCode);
objects.GetMulti(filter, relationsToUse);

I would like to add caching system to avoid to do request in database many times. I saw on LLBLGen documentation that it is possible to use cache on LLBLGen with this code:

var customers = new EntityCollection<CustomerEntity>();
using(var adapter = new DataAccessAdapter())
{
    var parameters = new QueryParameters()
    {
        CollectionToFetch = customers,
        FilterToUse = CustomerFields.Country=="USA", 
        CacheResultset = true,
        CacheDuration = new TimeSpan(0, 0, 10)  // cache for 10 seconds
    };
    adapter.FetchEntityCollection(parameters);
}

But I'm not able to found class DataAccessAdapter..

Do you have any idea, suggestion to resolve my issue ?

Thanks in advance,

If you created a llblgen project which uses SelfServicing there is no DataAccessAdapter, so project must be created with the Adapter option.

if this is so then it should be in xxxx.DatabaseSpecific

where xxxx is youre project name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM