[2229] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
| 3 | * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
| 4 | *
|
---|
| 5 | * This file is part of HeuristicLab.
|
---|
| 6 | *
|
---|
| 7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | */
|
---|
| 20 | #endregion
|
---|
| 21 |
|
---|
| 22 | using System;
|
---|
[2180] | 23 | using System.Collections.Generic;
|
---|
| 24 | using System.Data.Linq;
|
---|
| 25 | using System.Data.Linq.Mapping;
|
---|
| 26 | using System.Text;
|
---|
| 27 |
|
---|
[2194] | 28 | namespace HeuristicLab.Modeling.Database.SQLServerCompact {
|
---|
[2180] | 29 | [Table(Name="InputVariableResult")]
|
---|
[2194] | 30 | public class InputVariableResult : IInputVariableResult {
|
---|
[2180] | 31 | public InputVariableResult() {
|
---|
| 32 | this.model = default(EntityRef<Model>);
|
---|
| 33 | this.variable = default(EntityRef<Variable>);
|
---|
| 34 | this.result = default(EntityRef<Result>);
|
---|
| 35 | }
|
---|
| 36 |
|
---|
[2185] | 37 | public InputVariableResult(InputVariable inputVariable, Result result, double value)
|
---|
| 38 | : this() {
|
---|
[2203] | 39 | this.variableId = inputVariable.VariableId;
|
---|
| 40 | this.modelId = inputVariable.ModelId;
|
---|
| 41 | this.resultId = result.Id;
|
---|
[2185] | 42 | this.value = value;
|
---|
| 43 | }
|
---|
| 44 |
|
---|
[2180] | 45 | private int variableId;
|
---|
| 46 | [Column(Storage = "variableId", IsPrimaryKey = true)]
|
---|
| 47 | public int VariableId {
|
---|
| 48 | get { return this.variableId; }
|
---|
| 49 | private set {
|
---|
| 50 | if (variableId != value) {
|
---|
| 51 | if (variable.HasLoadedOrAssignedValue)
|
---|
| 52 | throw new ForeignKeyReferenceAlreadyHasValueException();
|
---|
| 53 | variableId = value;
|
---|
| 54 | }
|
---|
| 55 | }
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | private EntityRef<Variable> variable;
|
---|
| 59 | [Association(Storage = "variable", ThisKey = "VariableId", OtherKey = "Id", IsForeignKey = true)]
|
---|
[2197] | 60 | public Variable Variable {
|
---|
[2180] | 61 | get { return variable.Entity; }
|
---|
| 62 | }
|
---|
| 63 |
|
---|
[2197] | 64 | IVariable IInputVariableResult.Variable {
|
---|
| 65 | get { return this.Variable; }
|
---|
| 66 | }
|
---|
| 67 |
|
---|
[2180] | 68 | private int modelId;
|
---|
| 69 | [Column(Storage = "modelId", IsPrimaryKey = true)]
|
---|
| 70 | public int ModelId {
|
---|
| 71 | get { return this.modelId; }
|
---|
| 72 | private set {
|
---|
| 73 | if (modelId != value) {
|
---|
| 74 | if (model.HasLoadedOrAssignedValue)
|
---|
| 75 | throw new ForeignKeyReferenceAlreadyHasValueException();
|
---|
| 76 | modelId = value;
|
---|
| 77 | }
|
---|
| 78 | }
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 | private EntityRef<Model> model;
|
---|
| 82 | [Association(Storage = "model", ThisKey = "ModelId", OtherKey = "Id", IsForeignKey = true)]
|
---|
[2197] | 83 | public Model Model {
|
---|
[2180] | 84 | get { return model.Entity; }
|
---|
| 85 | }
|
---|
| 86 |
|
---|
[2197] | 87 | IModel IInputVariableResult.Model {
|
---|
| 88 | get { return this.Model; }
|
---|
| 89 | }
|
---|
| 90 |
|
---|
[2180] | 91 | private int resultId;
|
---|
| 92 | [Column(Storage = "resultId", IsPrimaryKey = true)]
|
---|
| 93 | public int ResultId {
|
---|
| 94 | get { return this.resultId; }
|
---|
| 95 | private set {
|
---|
| 96 | if (resultId != value) {
|
---|
| 97 | if (result.HasLoadedOrAssignedValue)
|
---|
| 98 | throw new ForeignKeyReferenceAlreadyHasValueException();
|
---|
| 99 | resultId = value;
|
---|
| 100 | }
|
---|
| 101 | }
|
---|
| 102 | }
|
---|
| 103 |
|
---|
| 104 | private EntityRef<Result> result;
|
---|
| 105 | [Association(Storage = "result", ThisKey = "ResultId", OtherKey = "Id", IsForeignKey = true)]
|
---|
[2197] | 106 | public Result Result {
|
---|
[2180] | 107 | get { return result.Entity; }
|
---|
| 108 | }
|
---|
[2185] | 109 |
|
---|
[2197] | 110 | IResult IInputVariableResult.Result {
|
---|
| 111 | get { return this.Result; }
|
---|
| 112 | }
|
---|
| 113 |
|
---|
[2185] | 114 | private double value;
|
---|
| 115 | [Column(Storage = "value", CanBeNull = false)]
|
---|
| 116 | public double Value {
|
---|
| 117 | get { return this.value; }
|
---|
| 118 | set { this.value = value; }
|
---|
| 119 | }
|
---|
[2180] | 120 | }
|
---|
| 121 | }
|
---|