Print Page | Close Window

Repositories in UOW do not work

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=4257
Printed Date: 05-May-2024 at 8:37am


Topic: Repositories in UOW do not work
Posted By: -ook
Subject: Repositories in UOW do not work
Date Posted: 30-Jul-2013 at 11:31pm
I have configured a Unit of Work (UOW) class that contains a variety of GlobalCacheRepositories pretty much exactly as per the TempHire reference application.
 
I have a GlobalChache class that has been loaded with the data these repositories reference as well (again as per TempHire).
 
However when I try to obtain data (in the ViewModel) from the UOW repositories 0 records are always returned. As a test I have passed the Global Cache to the function and queries that directly, and records are returned.
 
e.g.
 
                 // this will return 0 records
                var issuetreatments = await UnitOfWork.IssueTreatments.AllAsync(q => q.OrderBy(s => s.Name));
 
                // this will return 5 records (the correct amount)
                var issuetreatments2 = cache.Get<IssueTreatement>();
 
Does anyone have any pointers as to why this would be occuring?
 
Thanks
Mark



Replies:
Posted By: mgood
Date Posted: 30-Jul-2013 at 11:52pm
Most likely the EntityManagerProvider.ManagerCreated event gets triggered before the repositories had a chance to install their even handler. Make sure you don't access the Manager property before all the repositories get instantiated. 


Posted By: -ook
Date Posted: 31-Jul-2013 at 2:29pm
Thankyou, yes that was indeed the issue.
 
 



Print Page | Close Window