Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/13/15 15:22:51 (9 years ago)
Author:
ascheibe
Message:

#2388

  • prevent disposing of hive data context
  • more cleanups
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveStatistics/sources/HeuristicLab.Services.WebApp.Maintenance/3.3/WebApi/FactClientInfoController.cs

    r12777 r12858  
    3636
    3737    public DT.FactClientInfo GetFactClientInfo(DateTime start, DateTime end) {
    38       using (var pm = PersistenceManager) {
    39         var factClientInfo = pm.FactClientInfoDao;
    40         var query = factClientInfo.GetAll().Where(x => x.Time >= start && x.Time <= end);
    41         return new DT.FactClientInfo {
    42           Rows = query.Count(),
    43           Clients = query.Select(x => x.ClientId).Distinct().Count()
    44         };
    45       }
     38      var pm = PersistenceManager;
     39      var factClientInfo = pm.FactClientInfoDao;
     40      var query = factClientInfo.GetAll().Where(x => x.Time >= start && x.Time <= end);
     41      return new DT.FactClientInfo {
     42        Rows = query.Count(),
     43        Clients = query.Select(x => x.ClientId).Distinct().Count()
     44      };
    4645    }
    4746
    4847    public void Aggregate(DateTime start, DateTime end, int entries) {
    49       using (var pm = PersistenceManager) {
    50         var factClientInfoDao = pm.FactClientInfoDao;
    51         var dimTimeDao = pm.DimTimeDao;
    52         var clientIds = pm.UseTransaction(() => factClientInfoDao.GetAll()
    53           .Where(x => x.Time >= start && x.Time <= end)
    54           .Select(x => x.ClientId)
    55           .Distinct()
    56         );
    57         foreach (var id in clientIds) {
    58           AggregateClient(pm, id, start, end, entries);
    59         }
    60         dimTimeDao.DeleteUnusedTimes();
     48      var pm = PersistenceManager;
     49      var factClientInfoDao = pm.FactClientInfoDao;
     50      var dimTimeDao = pm.DimTimeDao;
     51      var clientIds = pm.UseTransaction(() => factClientInfoDao.GetAll()
     52        .Where(x => x.Time >= start && x.Time <= end)
     53        .Select(x => x.ClientId)
     54        .Distinct()
     55      );
     56      foreach (var id in clientIds) {
     57        AggregateClient(pm, id, start, end, entries);
    6158      }
     59      dimTimeDao.DeleteUnusedTimes();
    6260    }
    6361
Note: See TracChangeset for help on using the changeset viewer.