Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/ModelData.cs @ 2217

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

first part of performance improvements (ticket #712)

File size: 1.2 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Data.Linq;
4using System.Data.Linq.Mapping;
5using System.Text;
6
7namespace HeuristicLab.Modeling.Database.SQLServerCompact {
8  [Table(Name = "ModelData")]
9  public class ModelData {
10
11    public ModelData() {
12      this.model = default(EntityRef<Model>);
13    }
14
15    public ModelData(Model model, byte[] data)
16      : base() {
17      this.modelId = model.Id;
18      this.data = data;
19    }
20
21
22    private int modelId;
23    [Column(Storage = "modelId", IsPrimaryKey = true)]
24    public int ModelId {
25      get { return this.modelId; }
26      private set {
27        if (modelId != value) {
28          if (model.HasLoadedOrAssignedValue)
29            throw new ForeignKeyReferenceAlreadyHasValueException();
30          modelId = value;
31        }
32      }
33    }
34
35    private EntityRef<Model> model;
36    [Association(Storage = "model", ThisKey = "ModelId", OtherKey = "Id", IsForeignKey = true)]
37    public Model Model {
38      get { return model.Entity; }
39    }
40
41    private byte[] data;
42    [Column(Storage = "data", DbType = "image", CanBeNull = false)]
43    public byte[] Data {
44      get { return this.data; }
45      private set { this.data = value; }
46    }
47  }
48}
Note: See TracBrowser for help on using the repository browser.