I have the following Repository:
Public Class PageRepository
Private Shared _pages As BLL.PageCollection
Shared Function AllPages() As BLL.PageCollection
If _pages Is Nothing Then _pages = new BLL.PageCollection(LOADALL)
Return _pages
End Function
End Class
I do all selects using LINQ on the PageRepository.AllPages
, and I also Add new entities through the collection using Repository.AllPages.AddNew()
.
When I call Repository.AllPages.Save()
the data is stored in the database, however the _pages
private shared variable is maintained.
Should I somehow force a refresh of this variable everytime a page is updated? Or should this be done through a Module
/ Static class
and is my implementation wrong?