Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Linq (Join) with Entity Caching #7824


User avatar
0
sumitshah created

We have cached three entities using Entity Caching by referring the below documentation. https://aspnetboilerplate.com/Pages/Documents/Caching#entity-caching

We have to perform a linq on these cached enitites. Below is the linq perform using the repository.

var mailers = (from mailer in _mailerRepository.GetAll() join groupBroker in _groupBrokerRepository.GetAll() on mailer.BrokerID equals groupBroker.BrokerID join userGroup in _userGroupRepository.GetAll() on groupBroker.GroupID equals userGroup.GroupID where mailer.iIsActive && userGroup.UserId == _mySession.IDMSUserId && mailer.DatabaseID == input.DatabaseID && _offerRepository.GetAll().Any(offer => offer.MailerId == mailer.Id) orderby mailer.cCompany select mailer).Distinct();

We are not able to do the same with entity caching as EntityCacheBase class does have any method implemented which returns List<TCacheItem>. Could you please help us out and explain how can we implement this.


2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @sumitshah

    Entity Caching is designed for single entity access with Id of the related entity. It can't be used in such LinQ query.

  • User Avatar
    0
    ismcagdas created
    Support Team

    This issue is closed because it has not had recent activity for a long time.