Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/28/09 15:29:10 (15 years ago)
Author:
mkommend
Message:

adapted HeuristicLab.Modeling.Database and Database.SQLServerCompact (ticket #712)

Location:
branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact
Files:
2 deleted
10 edited
1 copied
1 moved

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/Algorithm.cs

    r2185 r2194  
    66using System.Text;
    77
    8 namespace HeuristicLab.Modeling.SQLServerCompactBackend {
     8namespace HeuristicLab.Modeling.Database.SQLServerCompact {
    99  [Table(Name = "Algorithm")]
    10   public class Algorithm {
     10  public class Algorithm : IAlgorithm  {
    1111    public Algorithm() {
    1212    }
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/InputVariable.cs

    r2185 r2194  
    55using System.Text;
    66
    7 namespace HeuristicLab.Modeling.SQLServerCompactBackend {
     7namespace HeuristicLab.Modeling.Database.SQLServerCompact {
    88  [Table(Name = "InputVariable")]
    9   public class InputVariable {
     9  public class InputVariable : IInputVariable {
    1010    public InputVariable() {
    1111      this.model = default(EntityRef<Model>);
     
    2727          if (variable.HasLoadedOrAssignedValue)
    2828            throw new ForeignKeyReferenceAlreadyHasValueException();
    29           variableId = value;
     29          variableId = value;         
    3030        }
    3131      }
     
    3434    private EntityRef<Variable> variable;
    3535    [Association(Storage = "variable", ThisKey = "VariableId", OtherKey = "Id", IsForeignKey = true)]
    36     public Variable Variable {
     36    public IVariable Variable {
    3737      get { return variable.Entity; }
    3838    }
     
    5353    private EntityRef<Model> model;
    5454    [Association(Storage = "model", ThisKey = "ModelId", OtherKey = "Id", IsForeignKey = true)]
    55     public Model Model {
     55    public IModel Model {
    5656      get { return model.Entity; }
    5757    }
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/InputVariableResult.cs

    r2185 r2194  
    55using System.Text;
    66
    7 namespace HeuristicLab.Modeling.SQLServerCompactBackend {
     7namespace HeuristicLab.Modeling.Database.SQLServerCompact {
    88  [Table(Name="InputVariableResult")]
    9   public class InputVariableResult {
     9  public class InputVariableResult : IInputVariableResult {
    1010    public InputVariableResult() {
    1111      this.model = default(EntityRef<Model>);
     
    1616    public InputVariableResult(InputVariable inputVariable, Result result, double value)
    1717      : this() {
    18       this.variable.Entity = inputVariable.Variable;
    19       this.model.Entity = inputVariable.Model;
     18      this.variable.Entity = (Variable)inputVariable.Variable;
     19      this.model.Entity = (Model)inputVariable.Model;
    2020      this.result.Entity = result;
    2121      this.value = value;
     
    3737    private EntityRef<Variable> variable;
    3838    [Association(Storage = "variable", ThisKey = "VariableId", OtherKey = "Id", IsForeignKey = true)]
    39     public Variable Variable {
     39    public IVariable Variable {
    4040      get { return variable.Entity; }
    4141    }
     
    5656    private EntityRef<Model> model;
    5757    [Association(Storage = "model", ThisKey = "ModelId", OtherKey = "Id", IsForeignKey = true)]
    58     public Model Model {
     58    public IModel Model {
    5959      get { return model.Entity; }
    6060    }
     
    7575    private EntityRef<Result> result;
    7676    [Association(Storage = "result", ThisKey = "ResultId", OtherKey = "Id", IsForeignKey = true)]
    77     public Result Result {
     77    public IResult Result {
    7878      get { return result.Entity; }
    7979    }
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/Model.cs

    r2190 r2194  
    66using System.Text;
    77
    8 namespace HeuristicLab.Modeling.SQLServerCompactBackend {
     8namespace HeuristicLab.Modeling.Database.SQLServerCompact {
    99  [Table(Name = "Model")]
    1010  public class Model : IModel{
     
    1414    }
    1515
    16     public Model(Variable targetVariable, Algorithm algorithm, byte[] model)
     16    public Model(Variable targetVariable, Algorithm algorithm, byte[] data)
    1717      : this() {
    1818      this.TargetVariable = targetVariable;
    1919      this.Algorithm = algorithm;
    20       this.modelData = model;
     20      this.Data = data;
    2121    }
    2222
     
    2828    }
    2929
    30     private byte[] modelData;
     30    private byte[] data;
    3131    [Column(Storage = "model", DbType = "image", CanBeNull = false)]
    32     public byte[] ModelData {
    33       get { return this.modelData; }
    34       set { this.modelData = value; }
     32    public byte[] Data {
     33      get { return this.data; }
     34      set { this.data = value; }
    3535    }
    3636
     
    5050    private EntityRef<Algorithm> algorithm;
    5151    [Association(Storage = "algorithm", ThisKey = "AlgorithmId", OtherKey = "Id", IsForeignKey = true)]
    52     public Algorithm Algorithm {
     52    public IAlgorithm Algorithm {
    5353      get { return this.algorithm.Entity; }
    54       set {
     54      private set {
    5555        Algorithm previousValue = algorithm.Entity;
    5656        if (previousValue != value || (!algorithm.HasLoadedOrAssignedValue)) {
     
    5858            algorithm.Entity = null;
    5959          }
    60           algorithm.Entity = value;
     60          algorithm.Entity = (Algorithm)value;
    6161          if (value != null) {
    62             algorithmId = value.Id;
     62            algorithmId = ((Algorithm)value).Id;
    6363          }
    6464        }
     
    8181    private EntityRef<Variable> targetVariable;
    8282    [Association(Storage = "targetVariable", ThisKey = "TargetVariableId", OtherKey = "Id", IsForeignKey = true)]
    83     public Variable TargetVariable {
     83    public IVariable TargetVariable {
    8484      get { return this.targetVariable.Entity; }
    85       set {
     85      private set {
    8686        Variable previousValue = targetVariable.Entity;
    8787        if (previousValue != value || (!targetVariable.HasLoadedOrAssignedValue)) {
     
    8989            targetVariable.Entity = null;
    9090          }
    91           targetVariable.Entity = value;
     91          targetVariable.Entity = (Variable)value;
    9292          if (value != null) {
    93             targetVariableId = value.Id;
     93            targetVariableId = ((Variable)value).Id;
    9494          }
    9595        }
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/ModelResult.cs

    r2185 r2194  
    55using System.Text;
    66
    7 namespace HeuristicLab.Modeling.SQLServerCompactBackend {
     7namespace HeuristicLab.Modeling.Database.SQLServerCompact {
    88  [Table(Name = "ModelResult")]
    99  public class ModelResult {
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/Problem.cs

    r2185 r2194  
    77using HeuristicLab.DataAnalysis;
    88
    9 namespace HeuristicLab.Modeling.SQLServerCompactBackend {
     9namespace HeuristicLab.Modeling.Database.SQLServerCompact {
    1010  [Table(Name = "Problem")]
    1111  public class Problem {
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/Result.cs

    r2190 r2194  
    66using System.Text;
    77
    8 namespace HeuristicLab.Modeling.SQLServerCompactBackend {
     8namespace HeuristicLab.Modeling.Database.SQLServerCompact {
    99  [Table(Name = "Result")]
    1010  public class Result : IResult {
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DataObjects/Variable.cs

    r2185 r2194  
    66using System.Text;
    77
    8 namespace HeuristicLab.Modeling.SQLServerCompactBackend {
     8namespace HeuristicLab.Modeling.Database.SQLServerCompact {
    99  [Table(Name = "Variable")]
    10   public class Variable {
     10  public class Variable : IVariable{
    1111    public Variable() {
    1212    }
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DatabaseService.cs

    r2190 r2194  
    99using HeuristicLab.GP.StructureIdentification;
    1010using HeuristicLab.Data;
    11 
    12 namespace HeuristicLab.Modeling.SQLServerCompactBackend {
     11using System.Data.Linq;
     12
     13namespace HeuristicLab.Modeling.Database.SQLServerCompact {
    1314  public class DatabaseService : IModelingDatabase {
    1415
     
    2930    }
    3031
    31     public void Persist(IAlgorithm algorithm) {
     32    public void Persist(HeuristicLab.Modeling.IAlgorithm algorithm) {
    3233      int trainingSamplesStart = ((IntData)algorithm.Engine.GlobalScope.GetVariableValue("TrainingSamplesStart", false)).Data;
    3334      int trainingSamplesEnd = ((IntData)algorithm.Engine.GlobalScope.GetVariableValue("TrainingSamplesEnd", false)).Data;
     
    179180
    180181    public IEnumerable<IResult> GetAllResults() {
    181       throw new NotImplementedException();
     182      using (ModelingDataContext ctx = new ModelingDataContext(connection)) {
     183        return ctx.Results.AsEnumerable().Cast<IResult>();
     184      }
    182185    }
    183186
     
    186189    #region ModelResult
    187190    public IEnumerable<IModelResult> GetModelResults(IModel model) {
    188       throw new NotImplementedException();
     191      ModelingDataContext ctx = new ModelingDataContext(connection);
     192      DataLoadOptions dlo = new DataLoadOptions();
     193      dlo.LoadWith<ModelResult>(mr => mr.Model);
     194      dlo.LoadWith<ModelResult>(mr => mr.Result);
     195      ctx.LoadOptions = dlo;
     196
     197      var results = from result in ctx.ModelResults
     198                    where result.Model == model
     199                    select result;
     200      return results.AsEnumerable().Cast<IModelResult>();
    189201    }
    190202    #endregion
    191203
    192204    #region Model
    193     public IEnumerable<IDatabaseModel> GetAllModels() {
    194       using (ModelingDataContext ctx = new ModelingDataContext(connection)) {
    195         return ctx.Models;
     205    public IEnumerable<IModel> GetAllModels() {
     206      using (ModelingDataContext ctx = new ModelingDataContext(connection)) {
     207        return ctx.Models.AsEnumerable().Cast<IModel>();
    196208      }
    197209    }
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/HeuristicLab.Modeling.Database.SQLServerCompact-3.2.csproj

    r2191 r2194  
    66    <ProductVersion>9.0.30729</ProductVersion>
    77    <SchemaVersion>2.0</SchemaVersion>
    8     <ProjectGuid>{9B4F7D05-CCE1-45BB-81D1-5D4925851901}</ProjectGuid>
     8    <ProjectGuid>{EC1AA756-D612-4FA6-AA52-25CF4F8E3836}</ProjectGuid>
    99    <OutputType>Library</OutputType>
    1010    <AppDesignerFolder>Properties</AppDesignerFolder>
    11     <RootNamespace>HeuristicLab.Modeling.SQLServerCompactBackend</RootNamespace>
    12     <AssemblyName>HeuristicLab.Modeling.SQLServerCompactBackend-3.2</AssemblyName>
     11    <RootNamespace>HeuristicLab.Modeling.Database.SQLServerCompact</RootNamespace>
     12    <AssemblyName>HeuristicLab.Modeling.Database.SQLServerCompact-3.2</AssemblyName>
    1313    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
    1414    <FileAlignment>512</FileAlignment>
     
    103103      <Name>HeuristicLab.GP.StructureIdentification-3.3</Name>
    104104    </ProjectReference>
     105    <ProjectReference Include="..\..\HeuristicLab.Modeling.Database\3.2\HeuristicLab.Modeling.Database-3.2.csproj">
     106      <Project>{E84E5717-79F8-498F-A5E0-A055C4EC086B}</Project>
     107      <Name>HeuristicLab.Modeling.Database-3.2</Name>
     108    </ProjectReference>
    105109    <ProjectReference Include="..\..\HeuristicLab.Modeling\3.2\HeuristicLab.Modeling-3.2.csproj">
    106110      <Project>{80F7FADA-549D-4151-8856-79B620A50DBA}</Project>
  • branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/ModelingDataContext.cs

    r2185 r2194  
    66using System.Text;
    77
    8 namespace HeuristicLab.Modeling.SQLServerCompactBackend {
     8namespace HeuristicLab.Modeling.Database.SQLServerCompact {
    99  public class ModelingDataContext : DataContext{
    1010    public ModelingDataContext(string connection)
Note: See TracChangeset for help on using the changeset viewer.