Changeset 2194 for branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DatabaseService.cs
- Timestamp:
- 07/28/09 15:29:10 (15 years ago)
- 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 9 9 using HeuristicLab.GP.StructureIdentification; 10 10 using HeuristicLab.Data; 11 12 namespace HeuristicLab.Modeling.SQLServerCompactBackend { 11 using System.Data.Linq; 12 13 namespace HeuristicLab.Modeling.Database.SQLServerCompact { 13 14 public class DatabaseService : IModelingDatabase { 14 15 … … 29 30 } 30 31 31 public void Persist( IAlgorithm algorithm) {32 public void Persist(HeuristicLab.Modeling.IAlgorithm algorithm) { 32 33 int trainingSamplesStart = ((IntData)algorithm.Engine.GlobalScope.GetVariableValue("TrainingSamplesStart", false)).Data; 33 34 int trainingSamplesEnd = ((IntData)algorithm.Engine.GlobalScope.GetVariableValue("TrainingSamplesEnd", false)).Data; … … 179 180 180 181 public IEnumerable<IResult> GetAllResults() { 181 throw new NotImplementedException(); 182 using (ModelingDataContext ctx = new ModelingDataContext(connection)) { 183 return ctx.Results.AsEnumerable().Cast<IResult>(); 184 } 182 185 } 183 186 … … 186 189 #region ModelResult 187 190 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>(); 189 201 } 190 202 #endregion 191 203 192 204 #region Model 193 public IEnumerable<I DatabaseModel> 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>(); 196 208 } 197 209 }
Note: See TracChangeset
for help on using the changeset viewer.