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/Result.cs

    r2178 r2179  
    11using System;
    22using System.Collections.Generic;
     3using System.Linq;
    34using System.Data.Linq;
    45using System.Data.Linq.Mapping;
     
    1112    }
    1213
     14    public Result(string name)
     15      : this() {
     16      this.name = name;
     17    }
     18
    1319    private int id;
    14     [Column(Storage = "id", DbType = "integer", IsPrimaryKey = true, IsDbGenerated = true, UpdateCheck = UpdateCheck.Never)]
     20    [Column(Storage = "id", IsPrimaryKey = true, IsDbGenerated = true)]
    1521    public int Id {
    1622      get { return this.id; }
     
    1925
    2026    private string name;
    21     [Column(Storage = "name", DbType = "VarChar(50) NOT NULL", CanBeNull = false)]
     27    [Column(Storage = "name", CanBeNull = false)]
    2228    public string Name {
    2329      get { return this.name; }
     
    2531    }
    2632
     33    public Dictionary<Model, double> ModelResultValues {
     34      get {
     35        using (ModelingDataContext ctx = new ModelingDataContext()) {
     36          var x = (from modelResult in ctx.ModelResults
     37                   where modelResult.Result == this
     38                   select modelResult).ToDictionary(
     39                    mr => mr.Model,
     40                    mr => mr.Value);
     41          return x;
     42        }
     43      }
     44    }
     45
    2746  }
    2847}
Note: See TracChangeset for help on using the changeset viewer.