private static ConcurrentDictionary <PerformanceResourceKey, int> InitFromDatabase()
 {
     PerformanceResourceIndex.log.Debug((object)"Loading PerformanceResourceIndex from database");
     try
     {
         ConcurrentDictionary <PerformanceResourceKey, int> concurrentDictionary = new ConcurrentDictionary <PerformanceResourceKey, int>();
         using (SqlCommand textCommand = SqlHelper.GetTextCommand("SELECT [ResourceTypeId], [ResourceName], [ResourceId] FROM [dbo].[WebsitePerformanceResource]"))
         {
             using (IDataReader dataReader = SqlHelper.ExecuteReader(textCommand))
             {
                 while (dataReader.Read())
                 {
                     PerformanceResourceKey index = new PerformanceResourceKey((WebResourceType)dataReader.GetInt32(0), dataReader.GetString(1));
                     concurrentDictionary[index] = dataReader.GetInt32(2);
                 }
             }
         }
         PerformanceResourceIndex.log.Debug((object)string.Format("Loaded {0} items into {1} from database", (object)concurrentDictionary.Count, (object)nameof(PerformanceResourceIndex)));
         return(concurrentDictionary);
     }
     catch (Exception ex)
     {
         PerformanceResourceIndex.log.Error((object)"Exception occurred when loading PerformanceResourceIndex from database", ex);
         throw;
     }
 }
 private int AddToDatabase(PerformanceResourceKey resourceId)
 {
     PerformanceResourceIndex.log.Debug((object)string.Format("Inserting performance resource key {0} into database", (object)resourceId));
     try
     {
         using (SqlCommand textCommand = SqlHelper.GetTextCommand("INSERT INTO [dbo].[WebsitePerformanceResource] \r\n         ([ResourceTypeId],[ResourceName]) \r\n         VALUES(@resourceTypeId, @resourceName)\r\n\r\nSELECT @@IDENTITY"))
         {
             textCommand.Parameters.AddWithValue("resourceTypeId", (object)resourceId.ResourceType);
             textCommand.Parameters.AddWithValue("resourceName", (object)resourceId.ResourceName);
             return(Convert.ToInt32(SqlHelper.ExecuteScalar(textCommand)));
         }
     }
     catch (Exception ex)
     {
         PerformanceResourceIndex.log.Error((object)string.Format("Exception occurred when inserting performance resource key {0} to database", (object)resourceId), ex);
         throw;
     }
 }