1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Data.Linq;
|
---|
4 | using System.Data.Linq.Mapping;
|
---|
5 | using System.Text;
|
---|
6 |
|
---|
7 | namespace 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.variable.Entity = (Variable)inputVariable.Variable;
|
---|
19 | this.model.Entity = (Model)inputVariable.Model;
|
---|
20 | this.result.Entity = result;
|
---|
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 IVariable Variable {
|
---|
40 | get { return variable.Entity; }
|
---|
41 | }
|
---|
42 |
|
---|
43 | private int modelId;
|
---|
44 | [Column(Storage = "modelId", IsPrimaryKey = true)]
|
---|
45 | public int ModelId {
|
---|
46 | get { return this.modelId; }
|
---|
47 | private set {
|
---|
48 | if (modelId != value) {
|
---|
49 | if (model.HasLoadedOrAssignedValue)
|
---|
50 | throw new ForeignKeyReferenceAlreadyHasValueException();
|
---|
51 | modelId = value;
|
---|
52 | }
|
---|
53 | }
|
---|
54 | }
|
---|
55 |
|
---|
56 | private EntityRef<Model> model;
|
---|
57 | [Association(Storage = "model", ThisKey = "ModelId", OtherKey = "Id", IsForeignKey = true)]
|
---|
58 | public IModel Model {
|
---|
59 | get { return model.Entity; }
|
---|
60 | }
|
---|
61 |
|
---|
62 | private int resultId;
|
---|
63 | [Column(Storage = "resultId", IsPrimaryKey = true)]
|
---|
64 | public int ResultId {
|
---|
65 | get { return this.resultId; }
|
---|
66 | private set {
|
---|
67 | if (resultId != value) {
|
---|
68 | if (result.HasLoadedOrAssignedValue)
|
---|
69 | throw new ForeignKeyReferenceAlreadyHasValueException();
|
---|
70 | resultId = value;
|
---|
71 | }
|
---|
72 | }
|
---|
73 | }
|
---|
74 |
|
---|
75 | private EntityRef<Result> result;
|
---|
76 | [Association(Storage = "result", ThisKey = "ResultId", OtherKey = "Id", IsForeignKey = true)]
|
---|
77 | public IResult Result {
|
---|
78 | get { return result.Entity; }
|
---|
79 | }
|
---|
80 |
|
---|
81 | private double value;
|
---|
82 | [Column(Storage = "value", CanBeNull = false)]
|
---|
83 | public double Value {
|
---|
84 | get { return this.value; }
|
---|
85 | set { this.value = value; }
|
---|
86 | }
|
---|
87 | }
|
---|
88 | }
|
---|