' Table class Public Class Table Private cName As String = "" Public Sub New(ByVal tcName As String) cName = tcName End Sub Public ReadOnly Property Name As String Get Return cName End Get End Property End Class Public Class Tables Inherits System.Collections.Specialized.NameObjectCollectionBase Public Overloads Sub Add(ByVal Table As Table) BaseAdd(Table.Name, Table) End Sub Default Public Overloads ReadOnly Property Item(ByVal Title As String) As Table Get Return CType(BaseGet(Title), Table) End Get End Property End ClassSo, I can then reference it like:
oApp.Tables("Member").Name
The definition is done when the application initializes. So, once the application starts, Tables will be initialized and can be accessed during the application. The problem is from the Web. The main class on a Web project is oProcess and not oApp. So, oApp becomes available as oProcess.oApp in such circumstances. So, on the first hit, when ASP.NET reloads the DLL, or on recycle, I can have two simultaneous hits which would want to initialize this. Basically, I have a oProcess.oApp.lInitialize property. Once it is set, the startup initialization won't fire again. But, when oProcess.oApp.lInitialize is False, if I can two simulatenous hits at first, they will see that the application initialization is not done and they will try to do it at the same time.' Select all the tables If Not loDataProvider.SQLExec("SELECT Table.* " + _ "FROM Table") Then Exit Function End If ' For each table For lnCounter = 0 To loDataProvider.nCount - 1 loRow = loDataProvider.oDataSet.Tables("Temp").Rows(lnCounter) loTable = New Table(loRow, oApp) oApp.Tables.Add(loTable) NextSo, if I have 76 tables, the For/Next will be done 76 times to initialize Tables. So, during that phase, if two hits are simultaneous when the application starts, this can create a mess. So, I need to find a way to initialize into something private and only initialize oApp.Tables at the end such as:
oApp.Tables=Tables2So, the goal is to make sure that the initialization of oApp.Tables is done private, by the use of a separate container, and only assign it in one shot at the end from one command. However, I am not sure how to do it. Because, this kind of container has to be declared Public.