From: Richard B. <rb...@us...> - 2004-12-17 00:28:50
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18057 Modified Files: CPersistenceBroker.vb Log Message: Error handling around the persistence broker. Fixed a problem in the deletePrivateObject Index: CPersistenceBroker.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistenceBroker.vb,v retrieving revision 1.82 retrieving revision 1.83 diff -u -d -r1.82 -r1.83 --- CPersistenceBroker.vb 15 Dec 2004 23:46:11 -0000 1.82 +++ CPersistenceBroker.vb 17 Dec 2004 00:28:37 -0000 1.83 @@ -193,12 +193,15 @@ Finally cm.RelationalDatabase.freeConnection(conn) outTicks = Now.Ticks - PCAverageTime.RawValue = outTicks - inTicks - PCAverageTimeBase.Increment() + Try + PCAverageTime.RawValue = outTicks - inTicks + PCAverageTimeBase.Increment() + Catch + End Try If Not x Is Nothing Then Throw x End If - End Try + End Try End SyncLock End Function @@ -273,7 +276,10 @@ Dim t As Type Dim resetLoadingFlag As Boolean - PCReads.Increment() + Try + PCReads.Increment() + Catch + End Try 'Storage for maps we will use to retrieve data (for the sql query) 'each entry will store the class map and the sql alias for the map @@ -288,7 +294,7 @@ Dim isfirst As Boolean = True Dim am As CAttributeMap - cm = obj.getClassMap + cm = obj.GetClassMap Debug.WriteLine("retrievePrivateObject: " & cm.Name) @@ -306,7 +312,10 @@ If t Is obj.GetObjectType Or t.IsSubclassOf(obj.GetObjectType) Then Debug.WriteLine("retrievePrivateObject: retreived from cache") obj = tmpObj - PCCacheHits.Increment() + Try + PCCacheHits.Increment() + Catch + End Try Return True End If End If @@ -347,7 +356,10 @@ 'Execute it and fill the data Dim rs As CResultset - PCSQLHits.Increment() + Try + PCSQLHits.Increment() + Catch + End Try rs = conn.processSelectStatement(statement) Debug.WriteLine("Select statement returned " & rs.ResultSet.Tables(0).Rows.Count & " row(s)") If rs.ResultSet.Tables(0).Rows.Count > 0 Then @@ -383,9 +395,12 @@ cm3 = cm2 cm2 = cm2.SuperClass End While - obj.IsProxy = False 'Need to set non-proxy in case object is loaded via a retrieve criteria - m_cache.Add(obj) 'Add retrieved object to the cache - PCCacheSize.RawValue = m_cache.Count + obj.IsProxy = False 'Need to set non-proxy in case object is loaded via a retrieve criteria + m_cache.Add(obj) 'Add retrieved object to the cache + Try + PCCacheSize.RawValue = m_cache.Count + Catch + End Try j = classMapCount + 1 Dim rw As DataRow @@ -414,11 +429,17 @@ tmpObj = m_cache.Item(targetobj) If Not (tmpObj Is Nothing) Then targetobj = tmpObj - PCCacheHits.Increment() + Try + PCCacheHits.Increment() + Catch + End Try Else ' All objects are loaded to the cache regardless of applications cache usage m_cache.Add(targetobj) - PCCacheSize.RawValue = m_cache.Count + Try + PCCacheSize.RawValue = m_cache.Count + Catch + End Try End If obj.SetAttributeValue(udamap.Target, targetobj.GetSourceObject) If Not targetobj.AssociationsLoaded Then @@ -448,11 +469,17 @@ tmpObj = m_cache.Item(targetobj) If Not (tmpObj Is Nothing) Then targetobj = tmpObj - PCCacheHits.Increment() + Try + PCCacheHits.Increment() + Catch + End Try Else ' All objects are loaded to the cache regardless of applications cache usage m_cache.Add(targetobj) - PCCacheSize.RawValue = m_cache.Count + Try + PCCacheSize.RawValue = m_cache.Count + Catch + End Try End If If Not targetobj.AssociationsLoaded Then If udamap.LazyLoad Then @@ -479,11 +506,17 @@ tmpObj = m_cache.Item(targetobj) If Not (tmpObj Is Nothing) Then targetobj = tmpObj - PCCacheHits.Increment() + Try + PCCacheHits.Increment() + Catch + End Try Else ' All objects are loaded to the cache regardless of applications cache usage m_cache.Add(targetobj) - PCCacheSize.RawValue = m_cache.Count + Try + PCCacheSize.RawValue = m_cache.Count + Catch + End Try End If If Not targetobj.AssociationsLoaded Then If udamap.LazyLoad Then @@ -515,11 +548,17 @@ tmpObj = m_cache.Item(targetobj) If Not (tmpObj Is Nothing) Then targetobj = tmpObj - PCCacheHits.Increment() + Try + PCCacheHits.Increment() + Catch + End Try Else ' All objects are loaded to the cache regardless of applications cache usage m_cache.Add(targetobj) - PCCacheSize.RawValue = m_cache.Count + Try + PCCacheSize.RawValue = m_cache.Count + Catch + End Try End If 'Need to determine if new object is already in the collection @@ -563,11 +602,17 @@ tmpObj = m_cache.Item(targetobj) If Not (tmpObj Is Nothing) Then targetobj = tmpObj - PCCacheHits.Increment() + Try + PCCacheHits.Increment() + Catch + End Try Else ' All objects are loaded to the cache regardless of applications cache usage m_cache.Add(targetobj) - PCCacheSize.RawValue = m_cache.Count + Try + PCCacheSize.RawValue = m_cache.Count + Catch + End Try End If 'Need to determine if new object is already in the collection '(prevents duplicates when multiple one-to-many associations exist) @@ -620,7 +665,10 @@ m_cache.ObjectsAreLoading = False End If m_cache.Add(obj) - PCCacheSize.RawValue = m_cache.Count + Try + PCCacheSize.RawValue = m_cache.Count + Catch + End Try Return True End Function @@ -667,7 +715,10 @@ If Value.HasValidKey Then anObjPers = m_cache.Item(Value) If Not anObjPers Is Nothing Then - PCCacheHits.Increment() + Try + PCCacheHits.Increment() + Catch + End Try Value = anObjPers Value.IsDirty = False Value.OriginalCacheKey = New CCacheKey(Value) @@ -692,7 +743,10 @@ retrieveObject(Value, False, False) Else Value = anObjPers - PCCacheHits.Increment() + Try + PCCacheHits.Increment() + Catch + End Try End If Value.IsDirty = False 'After populating a new object Value.OriginalCacheKey = New CCacheKey(Value) @@ -724,7 +778,10 @@ anObjPers.OriginalCacheKey = New CCacheKey(anObjPers) col.Add(anObjPers.GetSourceObject) m_cache.Add(anObjPers) 'Add retrieved objects to the cache - PCCacheSize.RawValue = m_cache.Count + Try + PCCacheSize.RawValue = m_cache.Count + Catch + End Try cursor.nextCursor() End While End If @@ -777,8 +834,11 @@ End Try cm.RelationalDatabase.freeConnection(conn) outTicks = Now.Ticks - PCAverageTime.RawValue = outTicks - inTicks - PCAverageTimeBase.Increment() + Try + PCAverageTime.RawValue = outTicks - inTicks + PCAverageTimeBase.Increment() + Catch + End Try End SyncLock End Sub @@ -825,13 +885,19 @@ If obj.Persistent Then statement = cm.getUpdateSqlFor(obj) conn.processStatement(statement) - PCSQLHits.Increment() - PCUpdates.Increment() + Try + PCSQLHits.Increment() + PCUpdates.Increment() + Catch + End Try Else statement = cm.getInsertSqlFor(obj) conn.processStatement(statement) - PCSQLHits.Increment() - PCInserts.Increment() + Try + PCSQLHits.Increment() + PCInserts.Increment() + Catch + End Try If cm.getIdentitySize > 0 Then If CInt(cm.RelationalDatabase.getValueFor(obj.GetValueByAttribute(cm.getIdentityAttributeMap(1).Name))) = 0 Then obj.SetAttributeValue(cm.getIdentityAttributeMap(1).Name, cm.RelationalDatabase.getIdentityValue(conn)) @@ -849,13 +915,19 @@ If Not obj.GetObjectType.IsSubclassOf(GetType(CPersistentObject)) Then If Not obj.OriginalCacheKey Is Nothing Then m_cache.Remove(obj.OriginalCacheKey) - PCCacheSize.RawValue = m_cache.Count + Try + PCCacheSize.RawValue = m_cache.Count + Catch + End Try End If End If obj.OriginalCacheKey = New CCacheKey(obj) If m_useCache Then m_cache.Add(obj) 'Add to the cache - PCCacheSize.RawValue = m_cache.Count + Try + PCCacheSize.RawValue = m_cache.Count + Catch + End Try End If End Sub @@ -899,19 +971,22 @@ Try deletePrivateObject(obj, conn, deleteSuperClass) conn.commit() - Catch ex As Exception + Catch ex As Exception x = New DeleteException(ex.Message, ex) conn.rollback() Finally cm.RelationalDatabase.freeConnection(conn) outTicks = Now.Ticks - PCAverageTime.RawValue = outTicks - inTicks - PCAverageTimeBase.Increment() - PCAverageTime.NextSample() + Try + PCAverageTime.RawValue = outTicks - inTicks + PCAverageTimeBase.Increment() + PCAverageTime.NextSample() + Catch + End Try If Not x Is Nothing Then Throw x End If - End Try + End Try End SyncLock End Sub @@ -930,7 +1005,10 @@ Public Sub deleteCachedObject(ByVal obj As IPersistableObject) If m_useCache Then m_cache.Remove(obj) - PCCacheSize.RawValue = m_cache.Count + Try + PCCacheSize.RawValue = m_cache.Count + Catch + End Try End If End Sub @@ -971,7 +1049,11 @@ Dim myKeys(cm.AssociationMaps.Count) As String cm.AssociationMaps.Keys.CopyTo(myKeys, 0) - PCDeletes.Increment() + Try + PCDeletes.Increment() + Catch + End Try + For i = 0 To cm.AssociationMaps.Count - 1 udaMap = cm.AssociationMaps.Item(myKeys(i)) @@ -989,7 +1071,11 @@ col = obj.GetCollectionByAttribute(udaMap.Target) If Not col Is Nothing Then For k = 0 To col.Count - 1 - Value = col.Item(k) + If col.Item(k).GetType.IsSubclassOf(GetType(CPersistentObject)) Then + Value = col.Item(k) + Else + Value = Me.getInjectedObject(col.Item(k)) + End If If retrieveObject(Value, False, True) Then 'If Value.Retrieve Then deletePrivateObject(Value, conn, deleteSuperClass) @@ -1004,7 +1090,10 @@ Dim statement As CSqlStatement statement = clMap.getDeleteSqlFor(obj) - PCSQLHits.Increment() + Try + PCSQLHits.Increment() + Catch + End Try conn.processStatement(statement) If deleteSuperClass Then @@ -1022,7 +1111,10 @@ obj.Persistent = False If m_useCache Then m_cache.Remove(obj) 'remove from the cache - PCCacheSize.RawValue = m_cache.Count + Try + PCCacheSize.RawValue = m_cache.Count + Catch + End Try End If colCriteriaParameters = Nothing End Sub @@ -1305,12 +1397,18 @@ ''' </history> '''----------------------------------------------------------------------------- Private Function processPrivateCriteria(ByVal pCriteria As CRetrieveCriteria, ByVal conn As _CConnection, ByVal fullObjects As Boolean) As CCursor - PCCriteria.Increment() + Try + PCCriteria.Increment() + Catch + End Try Dim statement As CSqlStatement statement = pCriteria.getSqlStatementParameters(fullObjects) - PCSQLHits.Increment() + Try + PCSQLHits.Increment() + Catch + End Try Dim rs As CResultset rs = conn.processSelectStatement(statement) @@ -1338,12 +1436,18 @@ ''' </history> '''----------------------------------------------------------------------------- Private Function processCriteria(ByVal pCriteria As CRetrieveCriteria, ByVal colCriteriaParameters As Collection, ByVal conn As _CConnection) As CCursor - PCCriteria.Increment() + Try + PCCriteria.Increment() + Catch + End Try Dim statement As CSqlStatement statement = pCriteria.getSqlStatementParameters() - PCSQLHits.Increment() + Try + PCSQLHits.Increment() + Catch + End Try Dim rs As CResultset rs = conn.processSelectStatement(statement) @@ -1386,7 +1490,10 @@ Public Sub addToCache(ByRef obj As CPersistentObject) If m_useCache Then m_cache.Add(obj) - PCCacheSize.RawValue = m_cache.Count + Try + PCCacheSize.RawValue = m_cache.Count + Catch + End Try End If End Sub @@ -1403,7 +1510,11 @@ ''' </history> '''----------------------------------------------------------------------------- Public Function processMultiRetrieveCriteria(ByRef pCriteria As CMultiRetrieveCriteria, ByVal fullObjects As Boolean) As CCursor - PCCriteria.Increment() + Try + PCCriteria.Increment() + Catch + End Try + Dim clMap As CClassMap clMap = pCriteria.getFirstObject.GetClassMap @@ -1415,7 +1526,10 @@ statement = pCriteria.getSqlStatementParameters(fullObjects) conn.AutoCommit = False - PCSQLHits.Increment() + Try + PCSQLHits.Increment() + Catch + End Try Dim cursor As CCursor Dim rs As CResultset @@ -1449,7 +1563,11 @@ ''' </history> '''----------------------------------------------------------------------------- Public Function processMultiSummaryCriteria(ByRef pCriteria As CMultiSummaryCriteria) As CCursor - PCCriteria.Increment() + Try + PCCriteria.Increment() + Catch + End Try + Dim clMap As CClassMap clMap = pCriteria.getFirstObject.GetClassMap @@ -1462,7 +1580,11 @@ conn.AutoCommit = False - PCSQLHits.Increment() + Try + PCSQLHits.Increment() + Catch + End Try + Dim cursor As CCursor Dim rs As CResultset Try @@ -1515,7 +1637,11 @@ ''' </history> '''----------------------------------------------------------------------------- Public Function processSummaryCriteria(ByRef obj As CPersistentObject, ByRef pCriteria As CSummaryCriteria) As CCursor - PCCriteria.Increment() + Try + PCCriteria.Increment() + Catch + End Try + Dim clMap As CClassMap clMap = obj.getClassMap(obj) @@ -1528,7 +1654,11 @@ conn.AutoCommit = False - PCSQLHits.Increment() + Try + PCSQLHits.Increment() + Catch + End Try + Dim cursor As CCursor Dim rs As CResultset Try @@ -1670,7 +1800,11 @@ conn = firstClassMap.RelationalDatabase.getConnection(Nothing) conn.AutoCommit = False - PCSQLHits.Increment() + Try + PCSQLHits.Increment() + Catch + End Try + Dim cursor As CCursor Dim rs As CResultset rs = conn.processSelectStatement(statement) @@ -1683,9 +1817,9 @@ Return cursor Catch - firstClassMap.RelationalDatabase.freeConnection(conn) - Return Nothing - End Try + firstClassMap.RelationalDatabase.freeConnection(conn) + Return Nothing + End Try End Function @@ -2458,7 +2592,11 @@ cursor.ClassMap = Nothing cursor.HoldsProxies = False st.SqlString = SQLString - 'PCSQLHits.Increment() + Try + PCSQLHits.Increment() + Catch + End Try + cursor.ResultSet = database.getConnection(Nothing).processSelectStatement(st) Return cursor End Function @@ -2492,7 +2630,10 @@ m_databases = Nothing m_cache = Nothing m_disposed = True - PCCacheSize.RawValue = 0 + Try + PCCacheSize.RawValue = 0 + Catch + End Try End If End If End Sub @@ -2510,7 +2651,10 @@ Public Sub ClearCache() m_cache.Clear() - PCCacheSize.RawValue = m_cache.Count + Try + PCCacheSize.RawValue = m_cache.Count + Catch + End Try End Sub Public Sub GetObject(ByRef obj As Object) @@ -2677,98 +2821,102 @@ End Property Friend Sub InitPerformanceCounters() - If Not PerformanceCounterCategory.Exists("AtomsFramework") Then - - Dim CCDC As New CounterCreationDataCollection + Try + If Not PerformanceCounterCategory.Exists("AtomsFramework") Then - Dim SQLHitsCount64 As New CounterCreationData - SQLHitsCount64.CounterType = PerformanceCounterType.RateOfCountsPerSecond64 - SQLHitsCount64.CounterHelp = "SQLStatements Executed per Sec." - SQLHitsCount64.CounterName = "PCSQLHits" - CCDC.Add(SQLHitsCount64) + Dim CCDC As New CounterCreationDataCollection - Dim CacheHitsCount64 As New CounterCreationData - CacheHitsCount64.CounterType = PerformanceCounterType.RateOfCountsPerSecond64 - CacheHitsCount64.CounterHelp = "Cache Reads per Sec." - CacheHitsCount64.CounterName = "PCCacheHits" - CCDC.Add(CacheHitsCount64) + Dim SQLHitsCount64 As New CounterCreationData + SQLHitsCount64.CounterType = PerformanceCounterType.RateOfCountsPerSecond64 + SQLHitsCount64.CounterHelp = "SQLStatements Executed per Sec." + SQLHitsCount64.CounterName = "PCSQLHits" + CCDC.Add(SQLHitsCount64) - Dim InsertsCount64 As New CounterCreationData - InsertsCount64.CounterType = PerformanceCounterType.RateOfCountsPerSecond64 - InsertsCount64.CounterHelp = "Inserts per Sec." - InsertsCount64.CounterName = "PCInserts" - CCDC.Add(InsertsCount64) + Dim CacheHitsCount64 As New CounterCreationData + CacheHitsCount64.CounterType = PerformanceCounterType.RateOfCountsPerSecond64 + CacheHitsCount64.CounterHelp = "Cache Reads per Sec." + CacheHitsCount64.CounterName = "PCCacheHits" + CCDC.Add(CacheHitsCount64) - Dim UpdatesCount64 As New CounterCreationData - UpdatesCount64.CounterType = PerformanceCounterType.RateOfCountsPerSecond64 - UpdatesCount64.CounterHelp = "Updates per Sec." - UpdatesCount64.CounterName = "PCUpdates" - CCDC.Add(UpdatesCount64) + Dim InsertsCount64 As New CounterCreationData + InsertsCount64.CounterType = PerformanceCounterType.RateOfCountsPerSecond64 + InsertsCount64.CounterHelp = "Inserts per Sec." + InsertsCount64.CounterName = "PCInserts" + CCDC.Add(InsertsCount64) - Dim ReadsCount64 As New CounterCreationData - ReadsCount64.CounterType = PerformanceCounterType.RateOfCountsPerSecond64 - ReadsCount64.CounterHelp = "Reads per Sec." - ReadsCount64.CounterName = "PCReads" - CCDC.Add(ReadsCount64) + Dim UpdatesCount64 As New CounterCreationData + UpdatesCount64.CounterType = PerformanceCounterType.RateOfCountsPerSecond64 + UpdatesCount64.CounterHelp = "Updates per Sec." + UpdatesCount64.CounterName = "PCUpdates" + CCDC.Add(UpdatesCount64) - Dim DeletesCount64 As New CounterCreationData - DeletesCount64.CounterType = PerformanceCounterType.RateOfCountsPerSecond64 - DeletesCount64.CounterHelp = "Deletes per Sec." - DeletesCount64.CounterName = "PCDeletes" - CCDC.Add(DeletesCount64) + Dim ReadsCount64 As New CounterCreationData + ReadsCount64.CounterType = PerformanceCounterType.RateOfCountsPerSecond64 + ReadsCount64.CounterHelp = "Reads per Sec." + ReadsCount64.CounterName = "PCReads" + CCDC.Add(ReadsCount64) - Dim CriteriaCount64 As New CounterCreationData - CriteriaCount64.CounterType = PerformanceCounterType.RateOfCountsPerSecond64 - CriteriaCount64.CounterHelp = "xCriteria per Sec." - CriteriaCount64.CounterName = "PCCriteria" - CCDC.Add(CriteriaCount64) + Dim DeletesCount64 As New CounterCreationData + DeletesCount64.CounterType = PerformanceCounterType.RateOfCountsPerSecond64 + DeletesCount64.CounterHelp = "Deletes per Sec." + DeletesCount64.CounterName = "PCDeletes" + CCDC.Add(DeletesCount64) - Dim CacheSizeCount64 As New CounterCreationData - CacheSizeCount64.CounterType = PerformanceCounterType.NumberOfItems64 - CacheSizeCount64.CounterHelp = "Cache Size (No. of entries)" - CacheSizeCount64.CounterName = "PCCacheSize" - CCDC.Add(CacheSizeCount64) + Dim CriteriaCount64 As New CounterCreationData + CriteriaCount64.CounterType = PerformanceCounterType.RateOfCountsPerSecond64 + CriteriaCount64.CounterHelp = "xCriteria per Sec." + CriteriaCount64.CounterName = "PCCriteria" + CCDC.Add(CriteriaCount64) - Dim AvgOpTimeCount64 As New CounterCreationData - AvgOpTimeCount64.CounterType = PerformanceCounterType.AverageTimer32 - AvgOpTimeCount64.CounterHelp = "Average Operation Time" - AvgOpTimeCount64.CounterName = "PCAverageTime" - CCDC.Add(AvgOpTimeCount64) + Dim CacheSizeCount64 As New CounterCreationData + CacheSizeCount64.CounterType = PerformanceCounterType.NumberOfItems64 + CacheSizeCount64.CounterHelp = "Cache Size (No. of entries)" + CacheSizeCount64.CounterName = "PCCacheSize" + CCDC.Add(CacheSizeCount64) - Dim BaseAvgOpTimeCount64 As New CounterCreationData - BaseAvgOpTimeCount64.CounterType = PerformanceCounterType.AverageBase - BaseAvgOpTimeCount64.CounterName = "Average Operation Time Count" - BaseAvgOpTimeCount64.CounterHelp = "PCAverageTimeBase" - CCDC.Add(BaseAvgOpTimeCount64) + Dim AvgOpTimeCount64 As New CounterCreationData + AvgOpTimeCount64.CounterType = PerformanceCounterType.AverageTimer32 + AvgOpTimeCount64.CounterHelp = "Average Operation Time" + AvgOpTimeCount64.CounterName = "PCAverageTime" + CCDC.Add(AvgOpTimeCount64) - ' Create the category. - PerformanceCounterCategory.Create("AtomsFramework", "Performance Counters for the AtomsFramework", CCDC) - End If + Dim BaseAvgOpTimeCount64 As New CounterCreationData + BaseAvgOpTimeCount64.CounterType = PerformanceCounterType.AverageBase + BaseAvgOpTimeCount64.CounterName = "Average Operation Time Count" + BaseAvgOpTimeCount64.CounterHelp = "PCAverageTimeBase" + CCDC.Add(BaseAvgOpTimeCount64) - Dim instanceName As String - instanceName = System.Diagnostics.Process.GetCurrentProcess.ProcessName - ' Create the counters. - PCSQLHits = New PerformanceCounter("AtomsFramework", "PCSQLHits", False) - PCCacheHits = New PerformanceCounter("AtomsFramework", "PCCacheHits", False) - PCInserts = New PerformanceCounter("AtomsFramework", "PCInserts", False) - PCUpdates = New PerformanceCounter("AtomsFramework", "PCUpdates", False) - PCReads = New PerformanceCounter("AtomsFramework", "PCReads", False) - PCDeletes = New PerformanceCounter("AtomsFramework", "PCDeletes", False) - PCCriteria = New PerformanceCounter("AtomsFramework", "PCCriteria", False) - PCCacheSize = New PerformanceCounter("AtomsFramework", "PCCacheSize", False) - PCAverageTime = New PerformanceCounter("AtomsFramework", "PCAverageTime", False) - PCAverageTimeBase = New PerformanceCounter("AtomsFramework", "PCAverageTimeBase", False) + ' Create the category. + PerformanceCounterCategory.Create("AtomsFramework", "Performance Counters for the AtomsFramework", CCDC) + End If - PCSQLHits.RawValue = 0 - PCCacheHits.RawValue = 0 - PCInserts.RawValue = 0 - PCUpdates.RawValue = 0 - PCReads.RawValue = 0 - PCDeletes.RawValue = 0 - PCCriteria.RawValue = 0 - PCCacheSize.RawValue = 0 - PCAverageTime.RawValue = 0 - PCAverageTimeBase.RawValue = 0 + Dim instanceName As String + instanceName = System.Diagnostics.Process.GetCurrentProcess.ProcessName + ' Create the counters. + PCSQLHits = New PerformanceCounter("AtomsFramework", "PCSQLHits", False) + PCCacheHits = New PerformanceCounter("AtomsFramework", "PCCacheHits", False) + PCInserts = New PerformanceCounter("AtomsFramework", "PCInserts", False) + PCUpdates = New PerformanceCounter("AtomsFramework", "PCUpdates", False) + PCReads = New PerformanceCounter("AtomsFramework", "PCReads", False) + PCDeletes = New PerformanceCounter("AtomsFramework", "PCDeletes", False) + PCCriteria = New PerformanceCounter("AtomsFramework", "PCCriteria", False) + PCCacheSize = New PerformanceCounter("AtomsFramework", "PCCacheSize", False) + PCAverageTime = New PerformanceCounter("AtomsFramework", "PCAverageTime", False) + PCAverageTimeBase = New PerformanceCounter("AtomsFramework", "PCAverageTimeBase", False) + PCSQLHits.RawValue = 0 + PCCacheHits.RawValue = 0 + PCInserts.RawValue = 0 + PCUpdates.RawValue = 0 + PCReads.RawValue = 0 + PCDeletes.RawValue = 0 + PCCriteria.RawValue = 0 + PCCacheSize.RawValue = 0 + PCAverageTime.RawValue = 0 + PCAverageTimeBase.RawValue = 0 + Catch ex As Exception + Trace.WriteLine("Could not create performance counters. If using ASP.NET please see http://objectsharp.com/Blogs/bruce/archive/2003/12/05/222.aspx" & _ + vbCrLf & ex.Message) + End Try End Sub End Class \ No newline at end of file |