Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/23/09 11:01:40 (15 years ago)
Author:
mkommend
Message:

implemented final prototyp of LinqToSql mapping (ticket #712)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/InputVariableResult.cs

    r2178 r2179  
    11using System;
    22using System.Collections.Generic;
    3 using System.Linq;
     3using System.Data.Linq;
     4using System.Data.Linq.Mapping;
    45using System.Text;
    56
    67namespace HeuristicLab.Modeling.SQLiteBackend {
     8  [Table(Name="InputVariableResult")]
    79  public class InputVariableResult {
     10    public InputVariableResult() {
     11      this.model = default(EntityRef<Model>);
     12      this.variable = default(EntityRef<Variable>);
     13      this.result = default(EntityRef<Result>);
     14    }
     15
     16    private int variableId;
     17    [Column(Storage = "variableId", IsPrimaryKey = true)]
     18    public int VariableId {
     19      get { return this.variableId; }
     20      private set {
     21        if (variableId != value) {
     22          if (variable.HasLoadedOrAssignedValue)
     23            throw new ForeignKeyReferenceAlreadyHasValueException();
     24          variableId = value;
     25        }
     26      }
     27    }
     28
     29    private EntityRef<Variable> variable;
     30    [Association(Storage = "variable", ThisKey = "VariableId", OtherKey = "Id", IsForeignKey = true)]
     31    public Variable Variable {
     32      get { return variable.Entity; }
     33    }
     34
     35    private int modelId;
     36    [Column(Storage = "modelId", IsPrimaryKey = true)]
     37    public int ModelId {
     38      get { return this.modelId; }
     39      private set {
     40        if (modelId != value) {
     41          if (model.HasLoadedOrAssignedValue)
     42            throw new ForeignKeyReferenceAlreadyHasValueException();
     43          modelId = value;
     44        }
     45      }
     46    }
     47
     48    private EntityRef<Model> model;
     49    [Association(Storage = "model", ThisKey = "ModelId", OtherKey = "Id", IsForeignKey = true)]
     50    public Model Model {
     51      get { return model.Entity; }
     52    }
     53
     54    private int resultId;
     55    [Column(Storage = "resultId", IsPrimaryKey = true)]
     56    public int ResultId {
     57      get { return this.resultId; }
     58      private set {
     59        if (resultId != value) {
     60          if (result.HasLoadedOrAssignedValue)
     61            throw new ForeignKeyReferenceAlreadyHasValueException();
     62          resultId = value;
     63        }
     64      }
     65    }
     66
     67    private EntityRef<Result> result;
     68    [Association(Storage = "result", ThisKey = "ResultId", OtherKey = "Id", IsForeignKey = true)]
     69    public Result Result {
     70      get { return result.Entity; }
     71    }
    872  }
    973}
Note: See TracChangeset for help on using the changeset viewer.