- Timestamp:
- 03/31/09 01:33:37 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Server.ADODataAccess/JobResultsAdapter.cs
r1449 r1468 6 6 using HeuristicLab.Hive.Contracts.BusinessObjects; 7 7 using HeuristicLab.DataAccess.ADOHelper; 8 using HeuristicLab.Hive.Server.ADODataAccess.dsHiveServerTableAdapters; 9 using System.Data.Common; 10 using System.Data.SqlClient; 8 11 9 12 namespace HeuristicLab.Hive.Server.ADODataAccess { 13 class JobResultsAdapterWrapper : 14 DataAdapterWrapperBase<dsHiveServerTableAdapters.JobResultTableAdapter, 15 JobResult, 16 dsHiveServer.JobResultRow> { 17 public override void UpdateRow(dsHiveServer.JobResultRow row) { 18 TransactionalAdapter.Update(row); 19 } 20 21 public override dsHiveServer.JobResultRow InsertNewRow(JobResult obj) { 22 dsHiveServer.JobResultDataTable data = 23 new dsHiveServer.JobResultDataTable(); 24 25 dsHiveServer.JobResultRow row = data.NewJobResultRow(); 26 row.JobResultId = obj.Id; 27 data.AddJobResultRow(row); 28 29 return row; 30 } 31 32 public override IEnumerable<dsHiveServer.JobResultRow> FindById(Guid id) { 33 return TransactionalAdapter.GetDataById(id); 34 } 35 36 public override IEnumerable<dsHiveServer.JobResultRow> FindAll() { 37 return TransactionalAdapter.GetData(); 38 } 39 40 protected override void SetConnection(DbConnection connection) { 41 adapter.Connection = connection as SqlConnection; 42 } 43 44 protected override void SetTransaction(DbTransaction transaction) { 45 adapter.Transaction = transaction as SqlTransaction; 46 } 47 } 48 10 49 class JobResultsAdapter: 11 50 DataAdapterBase<dsHiveServerTableAdapters.JobResultTableAdapter, … … 19 58 get { 20 59 if (clientAdapter == null) 21 clientAdapter = ServiceLocator.GetClientAdapter(); 60 clientAdapter = 61 this.Session.GetDataAdapter<ClientInfo, IClientAdapter>(); 22 62 23 63 return clientAdapter; … … 30 70 get { 31 71 if (jobAdapter == null) 32 jobAdapter = ServiceLocator.GetJobAdapter(); 72 jobAdapter = 73 this.Session.GetDataAdapter<Job, IJobAdapter>(); 33 74 34 75 return jobAdapter; … … 36 77 } 37 78 #endregion 79 80 public JobResultsAdapter(): base(new JobResultsAdapterWrapper()) { 81 } 38 82 39 83 #region Overrides … … 117 161 return null; 118 162 } 119 120 protected override void UpdateRow(dsHiveServer.JobResultRow row) {121 Adapter.Update(row);122 }123 124 protected override dsHiveServer.JobResultRow InsertNewRow(JobResult obj) {125 dsHiveServer.JobResultDataTable data =126 new dsHiveServer.JobResultDataTable();127 128 dsHiveServer.JobResultRow row = data.NewJobResultRow();129 row.JobResultId = obj.Id;130 data.AddJobResultRow(row);131 132 return row;133 }134 135 protected override IEnumerable<dsHiveServer.JobResultRow> FindById(Guid id) {136 return Adapter.GetDataById(id);137 }138 139 protected override IEnumerable<dsHiveServer.JobResultRow> FindAll() {140 return Adapter.GetData();141 }142 163 #endregion 143 164 144 165 #region IJobResultsAdapter Members 145 p ublic override voidUpdate(JobResult result) {166 protected override void doUpdate(JobResult result) { 146 167 if (result != null) { 147 168 ClientAdapter.Update(result.Client); 148 169 JobAdapter.Update(result.Job); 149 170 150 base. Update(result);171 base.doUpdate(result); 151 172 } 152 173 }
Note: See TracChangeset
for help on using the changeset viewer.