Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/InputVariable.cs @ 2203

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

corrected bugs in database sqlservercompact (ticket #712)

File size: 1.9 KB
RevLine 
[2180]1using System;
2using System.Collections.Generic;
3using System.Data.Linq;
4using System.Data.Linq.Mapping;
5using System.Text;
6
[2194]7namespace 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}
Note: See TracBrowser for help on using the repository browser.