How to access the Global object

F

Fabio Cavassini

Hi,

I have made a method in Global.asax called from Application_Start event
that loads some cache data from database to Application scope objets.

This is necessary because this is some data from data that don't change
very often.....but it could change.

So I have my method in Global.asax (it can't be Shared because it would
lost Application object scope), and I would like to call it manually to
refresh the cache when necessary.

Other thing I tryed is to move the method to a new class and make it
shared, but "Application" is not recognized.

How can I access Application object from outside Global.asax and use it
in a Shared sub? or How can I call the "Global" object instance from a
page?

This is the method's code :

Public Sub ReCargarCache()

Application.Lock()

Application(DC.TipoDeOperacion.ToString) =
StoredProcedures.GetIdNameTipoDeOperacion.Tables(0)
Application(DC.Shipper.ToString) =
StoredProcedures.GetIdNameShipper.Tables(0)
Application(DC.Incoterm.ToString) =
StoredProcedures.GetIdNameIncoterm.Tables(0)
Application(DC.MercadoShipper.ToString) =
StoredProcedures.GetIdNameMercadoShipper.Tables(0)
Application("Consignatario") =
StoredProcedures.GetIdNameProveedorDeServicioByServicio(CInt(eTipoDeServicio.eTipoDeServicioConsignatario)).Tables(0)
Application("Notify") =
Application(DC.Localidad.ToString) =
StoredProcedures.GetIdNameLocalidad.Tables(0)
Application(DC.Puerto.ToString) =
StoredProcedures.GetIdNamePuerto.Tables(0)
Application("Agente") =
StoredProcedures.GetIdNameProveedorDeServicioByServicio(CInt(eTipoDeServicio.eTipoDeServicioAgenteMaritimo)).Tables(0)
Application(DC.Motonave.ToString) =
StoredProcedures.GetIdNameMotonave.Tables(0)
Application(DC.Terminal.ToString) =
StoredProcedures.GetIdNameTerminal.Tables(0)

Application.UnLock()

End Sub

Regards
Fabio
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top