[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() {
|
---|
| 17 | this.model.Entity = model;
|
---|
| 18 | this.variable.Entity = variable;
|
---|
| 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)]
|
---|
[2194] | 36 | public IVariable Variable {
|
---|
[2180] | 37 | get { return variable.Entity; }
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | private int modelId;
|
---|
| 41 | [Column(Storage = "modelId", IsPrimaryKey = true)]
|
---|
| 42 | public int ModelId {
|
---|
| 43 | get { return this.modelId; }
|
---|
| 44 | private set {
|
---|
| 45 | if (modelId != value) {
|
---|
| 46 | if (model.HasLoadedOrAssignedValue)
|
---|
| 47 | throw new ForeignKeyReferenceAlreadyHasValueException();
|
---|
| 48 | modelId = value;
|
---|
| 49 | }
|
---|
| 50 | }
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | private EntityRef<Model> model;
|
---|
| 54 | [Association(Storage = "model", ThisKey = "ModelId", OtherKey = "Id", IsForeignKey = true)]
|
---|
[2194] | 55 | public IModel Model {
|
---|
[2180] | 56 | get { return model.Entity; }
|
---|
| 57 | }
|
---|
| 58 | }
|
---|
| 59 | }
|
---|