Last post Jan 04, 2006 05:12 PM by ikamiksok
Jan 03, 2006 02:54 PM|ikamiksok|LINK
There are several threads on using the scheduler but none that actually go into details so I was hoping for some feedback. Basically, anything that is run using the DNN Scheduler cannot access httpcontext. And unfortunately, a lot of DNN functions use httpcontext
at some point such as retrieving the current portalID from the current settings or another one is caching.
So where I am confused is in the DNN Data Layer. Many 3rd party modules I use including my own implement the DNN data layer and in the instance function use caching. Does this just cache the instance of the data layer object so you do not have to create
it every time? To avoid this, could you remove the cache and force it to create a new instance every time? Or, I suppose, create a direct call. Looking at this code called from a scheduler it looks like you can make this direct call in the scheduler:
As long as the
instance function is not cached.
Correct? To implement this would I create a 'new' function for my data layer that does not use cache or would I overload the instance function and not cache it. I am confused from looking at 3rd party dnn modules data layer and the DNN data layer dataprovider.vb
file at dnnroot/providers/dataproviders/sqldataprovider/dataprovider.vb
Thanks ahead of time for anyone who can provide some details here.
Here is the code......
Called from SchedulerClient.......
Public Sub DeleteSiteLog(ByVal DateTime As Date, ByVal PortalId As Integer)
Public Overrides Sub DeleteSiteLog(ByVal DateTime As Date, ByVal PortalId As Integer)
SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner & ObjectQualifier & "DeleteSiteLog", DateTime, PortalId)
Jan 04, 2006 05:12 PM|ikamiksok|LINK
OK. I'll answer my own post now that I figured it out. What I did was added the actual SQLProvider dll for my custom module to my references, create a new instance of the DataProvider class and called the function I wanted to use directly rather than use
the abstract layer above it which cached the instance. So I didn't have to write any new code this way although it is now sqlprovider dependent.