Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Hive_Milestone3/sources/HeuristicLab.Hive.Server.ADODataAccess/3.2/TableAdapterWrapper/JobResultsAdapterWrapper.cs @ 6451

Last change on this file since 6451 was 2099, checked in by svonolfe, 16 years ago

Further avoided out of memory exceptions by updating the JobResult DAO (#372)

File size: 1.8 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using HeuristicLab.DataAccess.ADOHelper;
6using System.Data.SqlClient;
7using HeuristicLab.Hive.Contracts.BusinessObjects;
8using System.Data.Common;
9
10namespace HeuristicLab.Hive.Server.ADODataAccess.TableAdapterWrapper {
11  class JobResultsAdapterWrapper :
12    TableAdapterWrapperBase<dsHiveServerTableAdapters.JobResultTableAdapter,
13                    JobResult,
14                    dsHiveServer.JobResultRow> {
15    public override void UpdateRow(dsHiveServer.JobResultRow row) {
16      TransactionalAdapter.Update(row);
17    }
18
19    public override dsHiveServer.JobResultRow InsertNewRow(JobResult obj) {
20      dsHiveServer.JobResultDataTable data =
21        new dsHiveServer.JobResultDataTable();
22
23      dsHiveServer.JobResultRow row = data.NewJobResultRow();
24      row.JobResultId = obj.Id;
25      data.AddJobResultRow(row);
26
27      return row;
28    }
29
30    public override IEnumerable<dsHiveServer.JobResultRow> FindById(Guid id) {
31      return TransactionalAdapter.GetDataById(id);
32    }
33
34    public override IEnumerable<dsHiveServer.JobResultRow> FindAll() {
35      return TransactionalAdapter.GetData();
36    }
37
38    public byte[] GetSerializedJobResult(Guid jobResultId) {
39      return TransactionalAdapter.GetSerializedJobResultById(jobResultId);
40    }
41
42    public bool UpdateSerialiedJobResult(byte[] serializedJobResult, Guid jobResultId) {
43      return TransactionalAdapter.UpdateSerializedJobResultById(serializedJobResult, jobResultId) > 0;
44    }
45
46    protected override void SetConnection(DbConnection connection) {
47      adapter.Connection = connection as SqlConnection;
48    }
49
50    protected override void SetTransaction(DbTransaction transaction) {
51      adapter.Transaction = transaction as SqlTransaction;
52    }
53  }
54}
Note: See TracBrowser for help on using the repository browser.