Hi everybody
I have coded a LINQ SiteMapProvider for my ASP.NET site. The site pages info is stored in a MSSQL database.
When I make changes to the SitePAges table, the SiteMap does not reset. Here is my code
Public Overrides Function BuildSiteMap() As System.Web.SiteMapNode
If RootMapNode IsNot Nothing Then Return RootMapNode
dcx = New GrabdayDataContext
RootMapNode = Nothing
Dim SitePages = From q In dcx.SitePages Where q.ParentID Is Nothing
Dim cmd As New SqlCommand("select sitepageid, parentid from SitePages", New SqlConnection(ConfigurationManager.ConnectionStrings("Grabday").ConnectionString))
Dim dependency = New SqlCacheDependency(cmd)
RootMapNode = SitePageNode(SitePages.FirstOrDefault)
AddNode(RootMapNode, Nothing)
AddChildNodes(RootMapNode, SitePages.FirstOrDefault)
HttpRuntime.Cache.Insert(_cacheDependencyName, New Object(), dependency, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.NotRemovable, New CacheItemRemovedCallback(AddressOf OnSiteMapChanged))
Return RootMapNode
End Function
Sub OnSiteMapChanged()
Clear()
End Sub
If i understand correctly, the OnSiteMapChanged sub is supposed to run as soon as the tableset becomes invalidated, which somehow never occurs. I put dependenct.start and dependency.stop in my global.asax file in app_start and app_end respectively
My debugging shows that the "Insert" code to the cache does occur, though i dont understand why it is needed (the code was ported from a sqlsitemapprovider). doesnt asp.net cache the data on its own? it definetly does.
Can someone help me get my data invalidated or whatever?
my db show that Is_Broker_Enabled is on