Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/ModelMetaData.cs @ 2384

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

stored model metadata into modeling.database
changed analyzermodel to use dictionary of string, object (ticket #731)

File size: 3.0 KB
Line 
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
22using System;
23using System.Collections.Generic;
24using System.Linq;
25using System.Data.Linq;
26using System.Data.Linq.Mapping;
27using System.Text;
28
29namespace HeuristicLab.Modeling.Database.SQLServerCompact {
30  [Table(Name = "ModelMetaData")]
31  public class ModelMetaData : IModelMetaData {
32    public ModelMetaData() {
33      this.model = default(EntityRef<Model>);
34      this.metadata = default(EntityRef<MetaData>);
35    }
36
37    public ModelMetaData(Model model, MetaData metadata, double value)
38      : this() {
39      this.modelId = model.Id;
40      this.metaDataId = metadata.Id;
41      this.value = value;
42    }
43
44    private double value;
45    [Column(Storage = "value", CanBeNull = false)]
46    public double Value {
47      get { return this.value; }
48      set { this.value = value; }
49    }
50
51    private int modelId;
52    [Column(Storage = "modelId", IsPrimaryKey = true, CanBeNull = false)]
53    public int ModelId {
54      get { return this.modelId; }
55      private set {
56        if (modelId != value) {
57          if (model.HasLoadedOrAssignedValue)
58            throw new ForeignKeyReferenceAlreadyHasValueException();
59        }
60        modelId = value;
61      }
62    }
63
64    private EntityRef<Model> model;
65    [Association(Storage = "model", ThisKey = "ModelId", OtherKey = "Id", IsForeignKey = true)]
66    public Model Model {
67      get { return this.model.Entity; }
68    }
69
70    IModel IModelMetaData.Model {
71      get { return this.Model; }
72    }
73
74    private int metaDataId;
75    [Column(Storage = "metaDataId", IsPrimaryKey = true, CanBeNull = false)]
76    public int MetaDataId {
77      get { return this.metaDataId; }
78      private set {
79        if (metaDataId != value) {
80          if (metadata.HasLoadedOrAssignedValue)
81            throw new ForeignKeyReferenceAlreadyHasValueException();
82        }
83        modelId = value;
84      }
85    }
86
87    private EntityRef<MetaData> metadata;
88    [Association(Storage = "metadata", ThisKey = "MetaDataId", OtherKey = "Id", IsForeignKey = true)]
89    public MetaData MetaData {
90      get { return this.metadata.Entity; }
91    }
92
93    IMetaData IModelMetaData.MetaData {
94      get { return this.MetaData; }
95    }
96
97  }
98}
Note: See TracBrowser for help on using the repository browser.