Changeset 12691 for branches/HiveStatistics/sources/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/SlaveGroupDao.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/SlaveGroupDao.cs
r12484 r12691 45 45 #region IGenericDao<Guid,SlaveGroup> Members 46 46 public SlaveGroup GetById(Guid id) { 47 return Entities.SingleOrDefault(x => x.ResourceId ==id);47 return GetByIdQuery(dataContext, id); 48 48 } 49 49 … … 112 112 113 113 public bool Exists(SlaveGroup entity) { 114 return Table.Contains(entity);114 return ExistsQuery(dataContext, entity); 115 115 } 116 116 … … 119 119 } 120 120 #endregion 121 122 #region Compiled queries 123 private static readonly Func<DataContext, Guid, SlaveGroup> GetByIdQuery = 124 CompiledQuery.Compile((DataContext db, Guid slaveGroupId) => 125 (from slaveGroup in db.GetTable<Resource>().OfType<SlaveGroup>() 126 where slaveGroup.ResourceId == slaveGroupId 127 select slaveGroup).SingleOrDefault()); 128 129 private static readonly Func<DataContext, SlaveGroup, bool> ExistsQuery = 130 CompiledQuery.Compile((DataContext db, SlaveGroup slaveGroup) => 131 db.GetTable<Resource>().OfType<SlaveGroup>().Contains(slaveGroup)); 132 #endregion 121 133 } 122 134 }
Note: See TracChangeset
for help on using the changeset viewer.