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:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • 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    }
Note: See TracChangeset for help on using the changeset viewer.