[2180] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Data.Linq;
|
---|
| 4 | using System.Data.Linq.Mapping;
|
---|
| 5 | using System.Text;
|
---|
| 6 |
|
---|
[2194] | 7 | namespace HeuristicLab.Modeling.Database.SQLServerCompact {
|
---|
[2180] | 8 | [Table(Name = "InputVariable")]
|
---|
[2194] | 9 | public class InputVariable : IInputVariable {
|
---|
[2180] | 10 | public InputVariable() {
|
---|
| 11 | this.model = default(EntityRef<Model>);
|
---|
| 12 | this.variable = default(EntityRef<Variable>);
|
---|
| 13 | }
|
---|
| 14 |
|
---|
| 15 | public InputVariable(Model model, Variable variable)
|
---|
| 16 | : base() {
|
---|
[2203] | 17 | this.modelId = model.Id;
|
---|
| 18 | this.variableId = variable.Id;
|
---|
[2180] | 19 | }
|
---|
| 20 |
|
---|
| 21 | private int variableId;
|
---|
| 22 | [Column(Storage = "variableId", IsPrimaryKey = true)]
|
---|
| 23 | public int VariableId {
|
---|
| 24 | get { return this.variableId; }
|
---|
| 25 | private set {
|
---|
| 26 | if (variableId != value) {
|
---|
| 27 | if (variable.HasLoadedOrAssignedValue)
|
---|
| 28 | throw new ForeignKeyReferenceAlreadyHasValueException();
|
---|
[2194] | 29 | variableId = value;
|
---|
[2180] | 30 | }
|
---|
| 31 | }
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | private EntityRef<Variable> variable;
|
---|
| 35 | [Association(Storage = "variable", ThisKey = "VariableId", OtherKey = "Id", IsForeignKey = true)]
|
---|
[2197] | 36 | public Variable Variable {
|
---|
[2180] | 37 | get { return variable.Entity; }
|
---|
| 38 | }
|
---|
| 39 |
|
---|
[2197] | 40 | IVariable IInputVariable.Variable {
|
---|
| 41 | get { return this.Variable; }
|
---|
| 42 | }
|
---|
| 43 |
|
---|
[2180] | 44 | private int modelId;
|
---|
| 45 | [Column(Storage = "modelId", IsPrimaryKey = true)]
|
---|
| 46 | public int ModelId {
|
---|
| 47 | get { return this.modelId; }
|
---|
| 48 | private set {
|
---|
| 49 | if (modelId != value) {
|
---|
| 50 | if (model.HasLoadedOrAssignedValue)
|
---|
| 51 | throw new ForeignKeyReferenceAlreadyHasValueException();
|
---|
| 52 | modelId = value;
|
---|
| 53 | }
|
---|
| 54 | }
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | private EntityRef<Model> model;
|
---|
| 58 | [Association(Storage = "model", ThisKey = "ModelId", OtherKey = "Id", IsForeignKey = true)]
|
---|
[2197] | 59 | public Model Model {
|
---|
[2180] | 60 | get { return model.Entity; }
|
---|
| 61 | }
|
---|
[2197] | 62 |
|
---|
| 63 | IModel IInputVariable.Model {
|
---|
| 64 | get { return this.Model;}
|
---|
| 65 | }
|
---|
[2180] | 66 | }
|
---|
| 67 | }
|
---|