Changeset 12691 for branches/HiveStatistics/sources/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/HiveStatistics/DimTimeDao.cs
- Timestamp:
- 07/08/15 15:51:32 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/HiveStatistics/DimTimeDao.cs
r12468 r12691 29 29 30 30 public override DimTime GetById(DateTime id) { 31 return Table.SingleOrDefault(x => x.Time ==id);31 return GetByIdQuery(DataContext, id); 32 32 } 33 33 public DimTime GetLastEntry() { 34 return Table.OrderByDescending(x => x.Time).FirstOrDefault();34 return GetLastEntryQuery(DataContext); 35 35 } 36 37 #region Compiled queries 38 private static readonly Func<DataContext, DateTime, DimTime> GetByIdQuery = 39 CompiledQuery.Compile((DataContext db, DateTime id) => 40 (from dimTime in db.GetTable<DimTime>() 41 where dimTime.Time == id 42 select dimTime).SingleOrDefault()); 43 44 private static readonly Func<DataContext, DimTime> GetLastEntryQuery = 45 CompiledQuery.Compile((DataContext db) => 46 (from dimTime in db.GetTable<DimTime>() 47 orderby dimTime.Time descending 48 select dimTime).FirstOrDefault()); 49 #endregion 36 50 } 37 51 }
Note: See TracChangeset
for help on using the changeset viewer.