Print Page | Close Window

GlobalCache

Printed From: IdeaBlade
Category: Cocktail
Forum Name: Community Forum
Forum Discription: A professional application framework using Caliburn.Micro and DevForce
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=4015
Printed Date: 24-Apr-2024 at 3:02am


Topic: GlobalCache
Posted By: gregweb
Subject: GlobalCache
Date Posted: 01-Mar-2013 at 9:26am
In LoadDataAsync of ContactAddressListViewModel, there is this code:

               var unitOfWork = _unitOfWorkManager.Get(0);
               var states = await unitOfWork.States.AllAsync(q => q.OrderBy(s => s.Name));
               StateEntities = new BindableCollection<StateEntity>(states);

It runs, but states are always empty. But if I look in the debugger and expand out the UnitOfWork to the entity manager, it shows that the States are in fact there.

In the GlobalCache, the states are loading up:

EntityManager.StateEntities.ExecuteAsync()

So I am not sure what the deal is. If I try to get any of the other types from the GlobalCache, the result is the same - zero entities. Of course it works fine in TempHire :)



Replies:
Posted By: gregweb
Date Posted: 01-Mar-2013 at 9:30am
OK, never mind. I was getting the default UOW instead of the one for the particular contact. In other words, the first line should be:

var unitOfWork = _unitOfWorkManager.Get(contactId);

Greg




Print Page | Close Window