Changeset 5459 for branches/OKB (trunk integration)
- Timestamp:
- 02/15/11 03:16:35 (14 years ago)
- Location:
- branches/OKB (trunk integration)
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OKB (trunk integration)/HeuristicLab.Services.OKB.DataAccess/3.3/OKB.dbml.layout
r5397 r5459 15 15 </nestedChildShapes> 16 16 </classShape> 17 <classShape Id="aa997e47-0162-4fc2-aa8d-e237c50c46fe" isExpanded="false" absoluteBounds="0.5, 2.125, 2, 0.45">17 <classShape Id="aa997e47-0162-4fc2-aa8d-e237c50c46fe" absoluteBounds="0.5, 2.125, 2, 1.1939925130208331"> 18 18 <DataClassMoniker Name="/OKBDataContext/AlgorithmUser" /> 19 19 <nestedChildShapes> … … 21 21 </nestedChildShapes> 22 22 </classShape> 23 <classShape Id="8d911be4-13c4-4abd-85de-4f93f280dd50" isExpanded="false" absoluteBounds="13.5, 2.125, 2, 0.45">23 <classShape Id="8d911be4-13c4-4abd-85de-4f93f280dd50" absoluteBounds="13.5, 2.125, 2, 1.1939925130208331"> 24 24 <DataClassMoniker Name="/OKBDataContext/ProblemUser" /> 25 25 <nestedChildShapes> … … 39 39 </nestedChildShapes> 40 40 </classShape> 41 <associationConnector edgePoints="[(8 : 1.8862939453125); (8 : 2.125)]" fixedFrom=" Algorithm" fixedTo="Algorithm">41 <associationConnector edgePoints="[(8 : 1.8862939453125); (8 : 2.125)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 42 42 <AssociationMoniker Name="/OKBDataContext/Platform/Platform_DataType" /> 43 43 <nodes> … … 58 58 </nestedChildShapes> 59 59 </classShape> 60 <associationConnector edgePoints="[(2.75 : 2.3 5); (2.5 : 2.35)]" fixedFrom="Algorithm" fixedTo="Algorithm">60 <associationConnector edgePoints="[(2.75 : 2.39024983723958); (2.5 : 2.39024983723958)]" fixedFrom="Algorithm" fixedTo="Algorithm"> 61 61 <AssociationMoniker Name="/OKBDataContext/Algorithm/Algorithm_AlgorithmUser" /> 62 62 <nodes> … … 65 65 </nodes> 66 66 </associationConnector> 67 <associationConnector edgePoints="[(2.5 : 1.19314697265625); (2.75 : 1.19314697265625)]" fixedFrom=" Algorithm" fixedTo="Algorithm">67 <associationConnector edgePoints="[(2.5 : 1.19314697265625); (2.75 : 1.19314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 68 68 <AssociationMoniker Name="/OKBDataContext/AlgorithmClass/AlgorithmClass_Algorithm" /> 69 69 <nodes> … … 72 72 </nodes> 73 73 </associationConnector> 74 <associationConnector edgePoints="[(7 : 2.39024983723958); (4.75 : 2.39024983723958)]" fixedFrom=" Algorithm" fixedTo="Algorithm">74 <associationConnector edgePoints="[(7 : 2.39024983723958); (4.75 : 2.39024983723958)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 75 75 <AssociationMoniker Name="/OKBDataContext/DataType/DataType_Algorithm" /> 76 76 <nodes> … … 79 79 </nodes> 80 80 </associationConnector> 81 <associationConnector edgePoints="[(7 : 1.19314697265625); (4.75 : 1.19314697265625)]" fixedFrom=" Algorithm" fixedTo="Algorithm">81 <associationConnector edgePoints="[(7 : 1.19314697265625); (4.75 : 1.19314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 82 82 <AssociationMoniker Name="/OKBDataContext/Platform/Platform_Algorithm" /> 83 83 <nodes> … … 92 92 </nestedChildShapes> 93 93 </classShape> 94 <associationConnector edgePoints="[(13.25 : 2.3 5); (13.5 : 2.35)]" fixedFrom="Algorithm" fixedTo="Algorithm">94 <associationConnector edgePoints="[(13.25 : 2.39024983723958); (13.5 : 2.39024983723958)]" fixedFrom="Algorithm" fixedTo="Algorithm"> 95 95 <AssociationMoniker Name="/OKBDataContext/Problem/Problem_ProblemUser" /> 96 96 <nodes> … … 99 99 </nodes> 100 100 </associationConnector> 101 <associationConnector edgePoints="[(9 : 2.39024983723958); (11.25 : 2.39024983723958)]" fixedFrom=" Algorithm" fixedTo="Algorithm">101 <associationConnector edgePoints="[(9 : 2.39024983723958); (11.25 : 2.39024983723958)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 102 102 <AssociationMoniker Name="/OKBDataContext/DataType/DataType_Problem" /> 103 103 <nodes> … … 106 106 </nodes> 107 107 </associationConnector> 108 <associationConnector edgePoints="[(9 : 1.19314697265625); (11.25 : 1.19314697265625)]" fixedFrom=" Algorithm" fixedTo="Algorithm">108 <associationConnector edgePoints="[(9 : 1.19314697265625); (11.25 : 1.19314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 109 109 <AssociationMoniker Name="/OKBDataContext/Platform/Platform_Problem" /> 110 110 <nodes> … … 113 113 </nodes> 114 114 </associationConnector> 115 <associationConnector edgePoints="[(13.5 : 1.19314697265625); (13.25 : 1.19314697265625)]" fixedFrom=" Algorithm" fixedTo="Algorithm">115 <associationConnector edgePoints="[(13.5 : 1.19314697265625); (13.25 : 1.19314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 116 116 <AssociationMoniker Name="/OKBDataContext/ProblemClass/ProblemClass_Problem" /> 117 117 <nodes> … … 126 126 </nestedChildShapes> 127 127 </classShape> 128 <associationConnector edgePoints="[(7 : 10.318 2703039497); (3.05835246852252 : 10.3182703039497); (3.05835246852252 : 2.65549967447917)]" fixedFrom="Caller" fixedTo="Caller">128 <associationConnector edgePoints="[(7 : 10.3181469726562); (2.98333686713063 : 10.3181469726562); (2.98333686713063 : 2.65549967447917)]" fixedFrom="Algorithm" fixedTo="Algorithm"> 129 129 <AssociationMoniker Name="/OKBDataContext/BinaryData/BinaryData_Algorithm" /> 130 130 <nodes> … … 133 133 </nodes> 134 134 </associationConnector> 135 <associationConnector edgePoints="[(9 : 10.3181469726562); (1 2.9275860029676 : 10.3181469726562); (12.9275860029676 : 2.65549967447917)]" fixedFrom="Algorithm" fixedTo="Caller">135 <associationConnector edgePoints="[(9 : 10.3181469726562); (13.0131477507419 : 10.3181469726562); (13.0131477507419 : 2.65549967447917)]" fixedFrom="Algorithm" fixedTo="Algorithm"> 136 136 <AssociationMoniker Name="/OKBDataContext/BinaryData/BinaryData_Problem" /> 137 137 <nodes> … … 146 146 </nestedChildShapes> 147 147 </classShape> 148 <associationConnector edgePoints="[(3.27917873426126 : 2.65549967447917); (3.27917873426126 : 8.32774983723958); (5.75 : 8.32774983723958)]" fixedFrom=" Algorithm" fixedTo="Algorithm">148 <associationConnector edgePoints="[(3.27917873426126 : 2.65549967447917); (3.27917873426126 : 8.32774983723958); (5.75 : 8.32774983723958)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 149 149 <AssociationMoniker Name="/OKBDataContext/Algorithm/Algorithm_Run" /> 150 150 <nodes> … … 153 153 </nodes> 154 154 </associationConnector> 155 <associationConnector edgePoints="[(12.7137905014838 : 2.65549967447917); (12.7137905014838 : 8.32774983723958); (8.13243692318721 : 8.32774983723958 : JumpStart); (7.96577025652055 : 8.32774983723958 : JumpEnd); (7.75 : 8.32774983723958)]" fixedFrom=" Algorithm" fixedTo="Algorithm">155 <associationConnector edgePoints="[(12.7137905014838 : 2.65549967447917); (12.7137905014838 : 8.32774983723958); (8.13243692318721 : 8.32774983723958 : JumpStart); (7.96577025652055 : 8.32774983723958 : JumpEnd); (7.75 : 8.32774983723958)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 156 156 <AssociationMoniker Name="/OKBDataContext/Problem/Problem_Run" /> 157 157 <nodes> … … 166 166 </nestedChildShapes> 167 167 </classShape> 168 <associationConnector edgePoints="[(8.04910358985388 : 9.625); (8.04910358985388 : 5.45496831242535); (7.75 : 5.45496831242535)]" manuallyRouted="true" fixedFrom=" Caller" fixedTo="Caller">168 <associationConnector edgePoints="[(8.04910358985388 : 9.625); (8.04910358985388 : 5.45496831242535); (7.75 : 5.45496831242535)]" manuallyRouted="true" fixedFrom="NotFixed" fixedTo="NotFixed"> 169 169 <AssociationMoniker Name="/OKBDataContext/BinaryData/BinaryData_Value" /> 170 170 <nodes> … … 173 173 </nodes> 174 174 </associationConnector> 175 <associationConnector edgePoints="[(7 : 3.07568669800201); (6.6959048132675 : 3.07568669800201); (6.6959048132675 : 4)]" fixedFrom=" Caller" fixedTo="Caller">175 <associationConnector edgePoints="[(7 : 3.07568669800201); (6.6959048132675 : 3.07568669800201); (6.6959048132675 : 4)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 176 176 <AssociationMoniker Name="/OKBDataContext/DataType/DataType_Value" /> 177 177 <nodes> … … 180 180 </nodes> 181 181 </associationConnector> 182 <associationConnector edgePoints="[(6.72310950465391 : 7.25); (6.72027766059957 : 6.92470540364583)]" manuallyRouted="true" fixedFrom=" Caller" fixedTo="Caller">182 <associationConnector edgePoints="[(6.72310950465391 : 7.25); (6.72027766059957 : 6.92470540364583)]" manuallyRouted="true" fixedFrom="NotFixed" fixedTo="NotFixed"> 183 183 <AssociationMoniker Name="/OKBDataContext/Run/Run_Value" /> 184 184 <nodes> … … 187 187 </nodes> 188 188 </associationConnector> 189 <associationConnector edgePoints="[(5.5 : 4.78929768880208); (5.75 : 4.78929768880208)]" fixedFrom=" Algorithm" fixedTo="Algorithm">189 <associationConnector edgePoints="[(5.5 : 4.78929768880208); (5.75 : 4.78929768880208)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 190 190 <AssociationMoniker Name="/OKBDataContext/ValueName/ValueName_Value" /> 191 191 <nodes> … … 206 206 </nestedChildShapes> 207 207 </classShape> 208 <associationConnector edgePoints="[(10.5 : 4.69314697265625); (10.25 : 4.69314697265625)]" fixedFrom=" Algorithm" fixedTo="Algorithm">208 <associationConnector edgePoints="[(10.5 : 4.69314697265625); (10.25 : 4.69314697265625)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 209 209 <AssociationMoniker Name="/OKBDataContext/Characteristic/Characteristic_CharacteristicValue" /> 210 210 <nodes> … … 213 213 </nodes> 214 214 </associationConnector> 215 <associationConnector edgePoints="[(9 : 3.05278498857512); (9.24152226977744 : 3.05278498857512); (9.24152226977744 : 4)]" fixedFrom=" Caller" fixedTo="Caller">215 <associationConnector edgePoints="[(9 : 3.05278498857512); (9.24152226977744 : 3.05278498857512); (9.24152226977744 : 4)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 216 216 <AssociationMoniker Name="/OKBDataContext/DataType/DataType_CharacteristicValue" /> 217 217 <nodes> … … 220 220 </nodes> 221 221 </associationConnector> 222 <associationConnector edgePoints="[(11.8118610455891 : 2.65549967447917); (11.8118610455891 : 3.0432292702094); (9.62689159819655 : 3.0432292702094); (9.62689159819655 : 4)]" manuallyRouted="true" fixedFrom=" Caller" fixedTo="Caller">222 <associationConnector edgePoints="[(11.8118610455891 : 2.65549967447917); (11.8118610455891 : 3.0432292702094); (9.62689159819655 : 3.0432292702094); (9.62689159819655 : 4)]" manuallyRouted="true" fixedFrom="NotFixed" fixedTo="NotFixed"> 223 223 <AssociationMoniker Name="/OKBDataContext/Problem/Problem_CharacteristicValue" /> 224 224 <nodes> -
branches/OKB (trunk integration)/HeuristicLab.Services.OKB.DataTransfer/3.3/Value.cs
r5378 r5459 35 35 public string Name { get; set; } 36 36 [DataMember] 37 public long RunId { get; set; }38 [DataMember]39 37 public long DataTypeId { get; set; } 40 38 } -
branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/AdministrationService.cs
r5389 r5459 75 75 } 76 76 } 77 public IEnumerable<DataTransfer.DataType> GetDataTypes() {78 using (OKBDataContext okb = new OKBDataContext()) {79 return okb.DataTypes.Select(x => Convert.ToDto(x)).ToArray();80 }81 }82 77 public long AddDataType(DataTransfer.DataType dto) { 83 78 using (OKBDataContext okb = new OKBDataContext()) { 84 DataAccess.DataType entity = Convert.ToEntity(dto); entity.Id = 0; 85 okb.DataTypes.InsertOnSubmit(entity); 86 okb.SubmitChanges(); 87 return entity.Id; 88 } 89 } 90 public void UpdateDataType(DataTransfer.DataType dto) { 91 using (OKBDataContext okb = new OKBDataContext()) { 92 DataAccess.DataType entity = okb.DataTypes.FirstOrDefault(x => x.Id == dto.Id); 93 Convert.ToEntity(dto, entity); 94 okb.SubmitChanges(); 95 } 96 } 97 public void DeleteDataType(long id) { 98 using (OKBDataContext okb = new OKBDataContext()) { 99 DataAccess.DataType entity = okb.DataTypes.FirstOrDefault(x => x.Id == id); 100 if (entity != null) okb.DataTypes.DeleteOnSubmit(entity); 101 okb.SubmitChanges(); 79 var entity = okb.DataTypes.Where(x => (x.PlatformId == dto.PlatformId) && (x.Name == dto.Name) && (x.TypeName == dto.TypeName)).FirstOrDefault(); 80 if (entity == null) { 81 entity = Convert.ToEntity(dto); entity.Id = 0; 82 okb.DataTypes.InsertOnSubmit(entity); 83 okb.SubmitChanges(); 84 } 85 return entity.Id; 102 86 } 103 87 } … … 130 114 } 131 115 } 132 public void DeleteBinaryData(long id) {133 using (OKBDataContext okb = new OKBDataContext()) {134 DataAccess.BinaryData entity = okb.BinaryDatas.FirstOrDefault(x => x.Id == id);135 if (entity != null) okb.BinaryDatas.DeleteOnSubmit(entity);136 okb.SubmitChanges();137 }138 }139 116 #endregion 140 117 … … 319 296 #endregion 320 297 321 #region ProblemParameter Methods 322 public DataTransfer.ProblemParameter GetProblemParameter(long id) { 323 using (OKBDataContext okb = new OKBDataContext()) { 324 return Convert.ToDto(okb.ProblemParameters.FirstOrDefault(x => x.Id == id)); 325 } 326 } 327 public IEnumerable<DataTransfer.ProblemParameter> GetProblemParameters(long problemId) { 328 using (OKBDataContext okb = new OKBDataContext()) { 329 return okb.ProblemParameters.Where(x => x.ProblemId == problemId).Select(x => Convert.ToDto(x)).ToArray(); 330 } 331 } 332 public long AddProblemParameter(DataTransfer.ProblemParameter dto) { 333 using (OKBDataContext okb = new OKBDataContext()) { 334 DataAccess.ProblemParameter entity = Convert.ToEntity(dto); entity.Id = 0; 335 okb.ProblemParameters.InsertOnSubmit(entity); 336 okb.SubmitChanges(); 337 return entity.Id; 338 } 339 } 340 public void UpdateProblemParameter(DataTransfer.ProblemParameter dto) { 341 using (OKBDataContext okb = new OKBDataContext()) { 342 DataAccess.ProblemParameter entity = okb.ProblemParameters.FirstOrDefault(x => x.Id == dto.Id); 343 Convert.ToEntity(dto, entity); 344 okb.SubmitChanges(); 345 } 346 } 347 public void DeleteProblemParameter(long id) { 348 using (OKBDataContext okb = new OKBDataContext()) { 349 DataAccess.ProblemParameter entity = okb.ProblemParameters.FirstOrDefault(x => x.Id == id); 350 if (entity != null) okb.ProblemParameters.DeleteOnSubmit(entity); 351 okb.SubmitChanges(); 352 } 353 } 354 #endregion 355 356 #region Result Methods 357 public DataTransfer.Result GetResult(long id) { 358 using (OKBDataContext okb = new OKBDataContext()) { 359 return Convert.ToDto(okb.Results.FirstOrDefault(x => x.Id == id)); 360 } 361 } 362 public IEnumerable<DataTransfer.Result> GetResults(long algorithmId) { 363 using (OKBDataContext okb = new OKBDataContext()) { 364 return okb.Results.Where(x => x.AlgorithmId == algorithmId).Select(x => Convert.ToDto(x)).ToArray(); 365 } 366 } 367 public long AddResult(DataTransfer.Result dto) { 368 using (OKBDataContext okb = new OKBDataContext()) { 369 DataAccess.Result entity = Convert.ToEntity(dto); entity.Id = 0; 370 okb.Results.InsertOnSubmit(entity); 371 okb.SubmitChanges(); 372 return entity.Id; 373 } 374 } 375 public void UpdateResult(DataTransfer.Result dto) { 376 using (OKBDataContext okb = new OKBDataContext()) { 377 DataAccess.Result entity = okb.Results.FirstOrDefault(x => x.Id == dto.Id); 378 Convert.ToEntity(dto, entity); 379 okb.SubmitChanges(); 380 } 381 } 382 public void DeleteResult(long id) { 383 using (OKBDataContext okb = new OKBDataContext()) { 384 DataAccess.Result entity = okb.Results.FirstOrDefault(x => x.Id == id); 385 if (entity != null) okb.Results.DeleteOnSubmit(entity); 386 okb.SubmitChanges(); 387 } 388 } 389 #endregion 390 391 #region Experiment Methods 392 public DataTransfer.Experiment GetExperiment(long id) { 298 #region Run Methods 299 public DataTransfer.Run GetRun(long id) { 393 300 using (OKBDataContext okb = new OKBDataContext()) { 394 301 DataLoadOptions dlo = new DataLoadOptions(); 395 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterBlobValues); 396 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterBoolValues); 397 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterFloatValues); 398 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterIntValues); 399 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterStringValues); 400 dlo.LoadWith<Experiment>(x => x.ProblemParameterBlobValues); 401 dlo.LoadWith<Experiment>(x => x.ProblemParameterBoolValues); 402 dlo.LoadWith<Experiment>(x => x.ProblemParameterFloatValues); 403 dlo.LoadWith<Experiment>(x => x.ProblemParameterIntValues); 404 dlo.LoadWith<Experiment>(x => x.ProblemParameterStringValues); 302 dlo.LoadWith<Run>(x => x.Values); 303 dlo.LoadWith<Value>(x => x.ValueName); 405 304 okb.LoadOptions = dlo; 406 return Convert.ToDto(okb. Experiments.FirstOrDefault(x => x.Id == id));407 } 408 } 409 public IEnumerable<DataTransfer. Experiment> GetExperiments(long algorithmId, long problemId) {305 return Convert.ToDto(okb.Runs.FirstOrDefault(x => x.Id == id)); 306 } 307 } 308 public IEnumerable<DataTransfer.Run> GetRuns(long algorithmId, long problemId) { 410 309 using (OKBDataContext okb = new OKBDataContext()) { 411 310 DataLoadOptions dlo = new DataLoadOptions(); 412 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterBlobValues); 413 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterBoolValues); 414 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterFloatValues); 415 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterIntValues); 416 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterStringValues); 417 dlo.LoadWith<Experiment>(x => x.ProblemParameterBlobValues); 418 dlo.LoadWith<Experiment>(x => x.ProblemParameterBoolValues); 419 dlo.LoadWith<Experiment>(x => x.ProblemParameterFloatValues); 420 dlo.LoadWith<Experiment>(x => x.ProblemParameterIntValues); 421 dlo.LoadWith<Experiment>(x => x.ProblemParameterStringValues); 311 dlo.LoadWith<Run>(x => x.Values); 312 dlo.LoadWith<Value>(x => x.ValueName); 422 313 okb.LoadOptions = dlo; 423 314 if ((algorithmId != 0) && (problemId != 0)) 424 return okb. Experiments.Where(x => (x.AlgorithmId == algorithmId) && (x.ProblemId == problemId)).Select(x => Convert.ToDto(x)).ToArray();315 return okb.Runs.Where(x => (x.AlgorithmId == algorithmId) && (x.ProblemId == problemId)).Select(x => Convert.ToDto(x)).ToArray(); 425 316 else if (algorithmId != 0) 426 return okb. Experiments.Where(x => x.AlgorithmId == algorithmId).Select(x => Convert.ToDto(x)).ToArray();317 return okb.Runs.Where(x => x.AlgorithmId == algorithmId).Select(x => Convert.ToDto(x)).ToArray(); 427 318 else if (problemId != 0) 428 return okb. Experiments.Where(x => x.ProblemId == problemId).Select(x => Convert.ToDto(x)).ToArray();319 return okb.Runs.Where(x => x.ProblemId == problemId).Select(x => Convert.ToDto(x)).ToArray(); 429 320 else 430 return okb.Experiments.Select(x => Convert.ToDto(x)).ToArray(); 431 } 432 } 433 public long AddExperiment(DataTransfer.Experiment dto) { 434 using (OKBDataContext okb = new OKBDataContext()) { 435 DataAccess.Experiment entity = Convert.ToEntity(dto); entity.Id = 0; 436 437 DataLoadOptions dlo = new DataLoadOptions(); 438 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterBlobValues); 439 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterBoolValues); 440 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterFloatValues); 441 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterIntValues); 442 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterStringValues); 443 dlo.LoadWith<Experiment>(x => x.ProblemParameterBlobValues); 444 dlo.LoadWith<Experiment>(x => x.ProblemParameterBoolValues); 445 dlo.LoadWith<Experiment>(x => x.ProblemParameterFloatValues); 446 dlo.LoadWith<Experiment>(x => x.ProblemParameterIntValues); 447 dlo.LoadWith<Experiment>(x => x.ProblemParameterStringValues); 448 okb.LoadOptions = dlo; 449 450 var experiments = okb.Experiments.Where(x => ((x.AlgorithmId == entity.AlgorithmId) && (x.ProblemId == entity.ProblemId))).ToArray(); 451 ExperimentEqualityComparer comparer = new ExperimentEqualityComparer(); 452 Experiment exp = experiments.FirstOrDefault(x => comparer.Equals(x, entity)); 453 if (exp != null) { 454 return exp.Id; 455 } else { 456 okb.Experiments.InsertOnSubmit(entity); 457 okb.SubmitChanges(); 458 return entity.Id; 459 } 460 } 461 } 462 public void DeleteExperiment(long id) { 463 foreach (DataTransfer.Run run in GetRuns(id)) 464 DeleteRun(run.Id); 465 466 using (OKBDataContext okb = new OKBDataContext()) { 467 IEnumerable<DataAccess.AlgorithmParameterBlobValue> algorithmParameterBlobValues = okb.AlgorithmParameterBlobValues.Where(x => x.ExperimentId == id); 468 okb.AlgorithmParameterBlobValues.DeleteAllOnSubmit(algorithmParameterBlobValues); 469 IEnumerable<DataAccess.AlgorithmParameterBoolValue> algorithmParameterBoolValues = okb.AlgorithmParameterBoolValues.Where(x => x.ExperimentId == id); 470 okb.AlgorithmParameterBoolValues.DeleteAllOnSubmit(algorithmParameterBoolValues); 471 IEnumerable<DataAccess.AlgorithmParameterFloatValue> algorithmParameterFloatValues = okb.AlgorithmParameterFloatValues.Where(x => x.ExperimentId == id); 472 okb.AlgorithmParameterFloatValues.DeleteAllOnSubmit(algorithmParameterFloatValues); 473 IEnumerable<DataAccess.AlgorithmParameterIntValue> algorithmParameterIntValues = okb.AlgorithmParameterIntValues.Where(x => x.ExperimentId == id); 474 okb.AlgorithmParameterIntValues.DeleteAllOnSubmit(algorithmParameterIntValues); 475 IEnumerable<DataAccess.AlgorithmParameterStringValue> algorithmParameterStringValues = okb.AlgorithmParameterStringValues.Where(x => x.ExperimentId == id); 476 okb.AlgorithmParameterStringValues.DeleteAllOnSubmit(algorithmParameterStringValues); 477 478 IEnumerable<DataAccess.ProblemParameterBlobValue> problemParameterBlobValues = okb.ProblemParameterBlobValues.Where(x => x.ExperimentId == id); 479 okb.ProblemParameterBlobValues.DeleteAllOnSubmit(problemParameterBlobValues); 480 IEnumerable<DataAccess.ProblemParameterBoolValue> problemParameterBoolValues = okb.ProblemParameterBoolValues.Where(x => x.ExperimentId == id); 481 okb.ProblemParameterBoolValues.DeleteAllOnSubmit(problemParameterBoolValues); 482 IEnumerable<DataAccess.ProblemParameterFloatValue> problemParameterFloatValues = okb.ProblemParameterFloatValues.Where(x => x.ExperimentId == id); 483 okb.ProblemParameterFloatValues.DeleteAllOnSubmit(problemParameterFloatValues); 484 IEnumerable<DataAccess.ProblemParameterIntValue> problemParameterIntValues = okb.ProblemParameterIntValues.Where(x => x.ExperimentId == id); 485 okb.ProblemParameterIntValues.DeleteAllOnSubmit(problemParameterIntValues); 486 IEnumerable<DataAccess.ProblemParameterStringValue> problemParameterStringValues = okb.ProblemParameterStringValues.Where(x => x.ExperimentId == id); 487 okb.ProblemParameterStringValues.DeleteAllOnSubmit(problemParameterStringValues); 488 489 DataAccess.Experiment entity = okb.Experiments.FirstOrDefault(x => x.Id == id); 490 if (entity != null) okb.Experiments.DeleteOnSubmit(entity); 491 okb.SubmitChanges(); 492 } 493 } 494 #endregion 495 496 #region Run Methods 497 public DataTransfer.Run GetRun(long id) { 498 using (OKBDataContext okb = new OKBDataContext()) { 499 DataLoadOptions dlo = new DataLoadOptions(); 500 dlo.LoadWith<Run>(x => x.ResultBlobValues); 501 dlo.LoadWith<Run>(x => x.ResultBoolValues); 502 dlo.LoadWith<Run>(x => x.ResultFloatValues); 503 dlo.LoadWith<Run>(x => x.ResultIntValues); 504 dlo.LoadWith<Run>(x => x.ResultStringValues); 505 okb.LoadOptions = dlo; 506 return Convert.ToDto(okb.Runs.FirstOrDefault(x => x.Id == id)); 507 } 508 } 509 public IEnumerable<DataTransfer.Run> GetRuns(long experimentId) { 510 using (OKBDataContext okb = new OKBDataContext()) { 511 DataLoadOptions dlo = new DataLoadOptions(); 512 dlo.LoadWith<Run>(x => x.ResultBlobValues); 513 dlo.LoadWith<Run>(x => x.ResultBoolValues); 514 dlo.LoadWith<Run>(x => x.ResultFloatValues); 515 dlo.LoadWith<Run>(x => x.ResultIntValues); 516 dlo.LoadWith<Run>(x => x.ResultStringValues); 517 okb.LoadOptions = dlo; 518 return okb.Runs.Where(x => x.ExperimentId == experimentId).Select(x => Convert.ToDto(x)).ToArray(); 321 return okb.Runs.Select(x => Convert.ToDto(x)).ToArray(); 519 322 } 520 323 } -
branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Convert.cs
r5389 r5459 53 53 return new DA.DataType { Id = source.Id, Name = source.Name, TypeName = source.TypeName, PlatformId = source.PlatformId }; 54 54 } 55 public static void ToEntity(DT.DataType source, DA.DataType target) {56 if ((source != null) && (target != null)) {57 target.Id = source.Id; target.Name = source.Name; target.TypeName = source.TypeName; target.PlatformId = source.PlatformId;58 }59 }60 55 #endregion 61 56 -
branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Interfaces/IAdministrationService.cs
r5389 r5459 49 49 DataType GetDataType(long id); 50 50 [OperationContract] 51 IEnumerable<DataType> GetDataTypes();52 [OperationContract]53 51 long AddDataType(DataType dto); 54 [OperationContract]55 void UpdateDataType(DataType dto);56 [OperationContract]57 void DeleteDataType(long id);58 52 #endregion 59 53 … … 63 57 [OperationContract] 64 58 long AddBinaryData(BinaryData dto); 65 [OperationContract]66 void DeleteBinaryData(long id);67 59 #endregion 68 60
Note: See TracChangeset
for help on using the changeset viewer.