Changeset 15630 for branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/JobDao.cs
- Timestamp:
- 01/18/18 15:08:25 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveProjectManagement/HeuristicLab.Services.Hive.DataAccess/3.3/Daos/JobDao.cs
r14185 r15630 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.Data.Linq; 24 25 using System.Linq; … … 31 32 return GetByIdQuery(DataContext, id); 32 33 } 34 35 public void DeleteByState(JobState state) { 36 DataContext.ExecuteCommand(DeleteByStateQueryString, Enum.GetName(typeof(JobState), state)); 37 } 38 39 public IEnumerable<Job> GetByState(JobState state) { 40 return GetByStateQuery(DataContext, state); 41 } 42 43 public IEnumerable<Guid> GetJobIdsByState(JobState state) { 44 return GetJobIdsByStateQuery(DataContext, state); 45 } 46 33 47 34 48 #region Compiled queries … … 38 52 where job.JobId == jobId 39 53 select job).SingleOrDefault()); 54 private static readonly Func<DataContext, JobState, IEnumerable<Job>> GetByStateQuery = 55 CompiledQuery.Compile((DataContext db, JobState jobState) => 56 (from job in db.GetTable<Job>() 57 where job.State == jobState 58 select job).ToList()); 59 private static readonly Func<DataContext, JobState, IEnumerable<Guid>> GetJobIdsByStateQuery = 60 CompiledQuery.Compile((DataContext db, JobState jobState) => 61 (from job in db.GetTable<Job>() 62 where job.State == jobState 63 select job.JobId).ToList()); 64 #endregion 65 66 #region String queries 67 private const string DeleteByStateQueryString = @" 68 DELETE FROM [Job] 69 WHERE JobState = {0} 70 "; 40 71 #endregion 41 72 }
Note: See TracChangeset
for help on using the changeset viewer.