Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/InputVariableResult.cs @ 2223

Last change on this file since 2223 was 2223, checked in by mkommend, 15 years ago

reintegrated branch new heuristic.modeling database backend (ticket #712)

File size: 2.9 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Data.Linq;
4using System.Data.Linq.Mapping;
5using System.Text;
6
7namespace HeuristicLab.Modeling.Database.SQLServerCompact {
8  [Table(Name="InputVariableResult")]
9  public class InputVariableResult : IInputVariableResult {
10    public InputVariableResult() {
11      this.model = default(EntityRef<Model>);
12      this.variable = default(EntityRef<Variable>);
13      this.result = default(EntityRef<Result>);
14    }
15
16    public InputVariableResult(InputVariable inputVariable, Result result, double value)
17      : this() {
18      this.variableId = inputVariable.VariableId;
19      this.modelId = inputVariable.ModelId;
20      this.resultId = result.Id;
21      this.value = value;
22    }
23
24    private int variableId;
25    [Column(Storage = "variableId", IsPrimaryKey = true)]
26    public int VariableId {
27      get { return this.variableId; }
28      private set {
29        if (variableId != value) {
30          if (variable.HasLoadedOrAssignedValue)
31            throw new ForeignKeyReferenceAlreadyHasValueException();
32          variableId = value;
33        }
34      }
35    }
36
37    private EntityRef<Variable> variable;
38    [Association(Storage = "variable", ThisKey = "VariableId", OtherKey = "Id", IsForeignKey = true)]
39    public Variable Variable {
40      get { return variable.Entity; }
41    }
42
43    IVariable IInputVariableResult.Variable {
44      get { return this.Variable; }
45    }
46
47    private int modelId;
48    [Column(Storage = "modelId", IsPrimaryKey = true)]
49    public int ModelId {
50      get { return this.modelId; }
51      private set {
52        if (modelId != value) {
53          if (model.HasLoadedOrAssignedValue)
54            throw new ForeignKeyReferenceAlreadyHasValueException();
55          modelId = value;
56        }
57      }
58    }
59
60    private EntityRef<Model> model;
61    [Association(Storage = "model", ThisKey = "ModelId", OtherKey = "Id", IsForeignKey = true)]
62    public Model Model {
63      get { return model.Entity; }
64    }
65
66    IModel IInputVariableResult.Model {
67      get { return this.Model; }
68    }
69
70    private int resultId;
71    [Column(Storage = "resultId", IsPrimaryKey = true)]
72    public int ResultId {
73      get { return this.resultId; }
74      private set {
75        if (resultId != value) {
76          if (result.HasLoadedOrAssignedValue)
77            throw new ForeignKeyReferenceAlreadyHasValueException();
78          resultId = value;
79        }
80      }
81    }
82
83    private EntityRef<Result> result;
84    [Association(Storage = "result", ThisKey = "ResultId", OtherKey = "Id", IsForeignKey = true)]
85    public Result Result {
86      get { return result.Entity; }
87    }
88
89    IResult IInputVariableResult.Result {
90      get { return this.Result; }
91    }
92
93    private double value;
94    [Column(Storage = "value", CanBeNull = false)]
95    public double Value {
96      get { return this.value; }
97      set { this.value = value; }
98    }
99  }
100}
Note: See TracBrowser for help on using the repository browser.