Changeset 4591 for branches/OKB
- Timestamp:
- 10/11/10 01:32:03 (14 years ago)
- Location:
- branches/OKB
- Files:
-
- 19 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OKB/HeuristicLab.Clients.OKB-3.3/OKBClient.cs
r4587 r4591 144 144 else if (item is Result) 145 145 item.Id = CallAdminService<long>(s => s.AddResult((Result)item)); 146 else if (item is Experiment) 147 item.Id = CallAdminService<long>(s => s.AddExperiment((Experiment)item)); 148 else if (item is Run) 149 item.Id = CallAdminService<long>(s => s.AddRun((Run)item)); 146 150 } else { 147 151 if (item is Platform) … … 163 167 else if (item is Result) 164 168 CallAdminService(s => s.UpdateResult((Result)item)); 169 else if (item is Experiment) 170 item.Id = CallAdminService<long>(s => s.AddExperiment((Experiment)item)); 171 else if (item is Run) 172 item.Id = CallAdminService<long>(s => s.AddRun((Run)item)); 165 173 } 166 174 return true; … … 315 323 316 324 #region Run Methods 317 public bool AddRun(long algorithmId, long problemId, Run run) {325 public bool AddRun(long algorithmId, long problemId, HeuristicLab.Optimization.Run run) { 318 326 try { 319 327 IAlgorithm algorithm = run.Algorithm; … … 321 329 322 330 ItemCollection<AlgorithmParameter> algorithmParameters = GetAlgorithmParameters(algorithmId); 323 AddAlgorithmParamters(algorithmId, algorithmParameters, algorithm, "");331 List<AlgorithmParameterValue> algorithmParameterValues = CollectAlgorithmParameterValues(algorithmId, algorithmParameters, algorithm, ""); 324 332 ItemCollection<ProblemParameter> problemParameters = GetProblemParameters(problemId); 325 AddProblemParamters(problemId, problemParameters, problem, ""); 333 List<ProblemParameterValue> problemParameterValues = CollectProblemParamterValues(problemId, problemParameters, problem, ""); 334 ItemCollection<Result> results = GetResults(algorithmId); 335 List<ResultValue> resultValues = CollectResultValues(algorithmId, results, algorithm); 336 337 Experiment exp = new Experiment(); 338 exp.AlgorithmId = algorithmId; 339 exp.ProblemId = problemId; 340 exp.AlgorithmParameterValues = algorithmParameterValues.ToArray(); 341 exp.ProblemParameterValues = problemParameterValues.ToArray(); 342 exp.Store(); 343 344 Run r = new Run(); 345 r.ExperimentId = exp.Id; 346 r.ClientId = Guid.NewGuid(); 347 r.FinishedDate = DateTime.Now; 348 r.RandomSeed = ((IntValue)((IValueParameter)run.Parameters["Seed"]).Value).Value; 349 r.ResultValues = resultValues.ToArray(); 350 r.Store(); 326 351 327 352 return true; … … 333 358 } 334 359 335 private void AddAlgorithmParamters(long algorithmId, ItemCollection<AlgorithmParameter> parameters, IParameterizedItem item, string prefix) { 360 private List<AlgorithmParameterValue> CollectAlgorithmParameterValues(long algorithmId, ItemCollection<AlgorithmParameter> parameters, IParameterizedItem item, string prefix) { 361 List<AlgorithmParameterValue> values = new List<AlgorithmParameterValue>(); 336 362 foreach (IValueParameter param in item.Parameters.OfType<IValueParameter>()) { 337 if (param.GetsCollected && (param.Value != null) && (parameters.FirstOrDefault(x => x.Name == prefix + param.Name) == null)) { 338 AlgorithmParameter p = new AlgorithmParameter(); 339 p.Name = prefix + param.Name; 340 p.Alias = prefix + param.Name; 341 p.Description = param.Description; 342 p.AlgorithmId = algorithmId; 343 p.DataTypeId = ConvertToDataType(param.DataType).Id; 344 p.Store(); 345 parameters.Add(p); 346 } 363 if (param.GetsCollected && (param.Value != null)) { 364 AlgorithmParameter p = parameters.FirstOrDefault(x => x.Name == prefix + param.Name); 365 if (p == null) { 366 p = new AlgorithmParameter(); 367 p.Name = prefix + param.Name; 368 p.Alias = prefix + param.Name; 369 p.Description = param.Description; 370 p.AlgorithmId = algorithmId; 371 p.DataTypeId = ConvertToDataType(param.DataType).Id; 372 p.Store(); 373 parameters.Add(p); 374 } 375 AlgorithmParameterValue value = null; 376 // TODO 377 value.AlgorithmParameterId = p.Id; 378 value.DataTypeId = ConvertToDataType(param.Value.GetType()).Id; 379 } 380 347 381 if (param.Value is IParameterizedItem) 348 AddAlgorithmParamters(algorithmId, parameters, (IParameterizedItem)param.Value, (string.IsNullOrEmpty(prefix) ? param.Name : prefix + param.Name) + "."); 349 } 350 } 351 private void AddProblemParamters(long problemId, ItemCollection<ProblemParameter> parameters, IParameterizedItem item, string prefix) { 382 values.AddRange(CollectAlgorithmParameterValues(algorithmId, parameters, (IParameterizedItem)param.Value, (string.IsNullOrEmpty(prefix) ? param.Name : prefix + param.Name) + ".")); 383 } 384 return values; 385 } 386 private List<ProblemParameterValue> CollectProblemParamterValues(long problemId, ItemCollection<ProblemParameter> parameters, IParameterizedItem item, string prefix) { 387 List<ProblemParameterValue> values = new List<ProblemParameterValue>(); 352 388 foreach (IValueParameter param in item.Parameters.OfType<IValueParameter>()) { 353 389 if (param.GetsCollected && (param.Value != null) && (parameters.FirstOrDefault(x => x.Name == prefix + param.Name) == null)) { … … 362 398 } 363 399 if (param.Value is IParameterizedItem) 364 AddProblemParamters(problemId, parameters, (IParameterizedItem)param.Value, (string.IsNullOrEmpty(prefix) ? param.Name : prefix + param.Name) + "."); 365 } 400 values.AddRange(CollectProblemParamterValues(problemId, parameters, (IParameterizedItem)param.Value, (string.IsNullOrEmpty(prefix) ? param.Name : prefix + param.Name) + ".")); 401 } 402 return values; 403 } 404 private List<ResultValue> CollectResultValues(long algorithmId, ItemCollection<Result> results, IAlgorithm algorithm) { 405 List<ResultValue> values = new List<ResultValue>(); 406 foreach (IResult result in algorithm.Results) { 407 if ((result.Value != null) && (results.FirstOrDefault(x => x.Name == result.Name) == null)) { 408 Result r = new Result(); 409 r.Name = result.Name; 410 r.Alias = result.Name; 411 r.Description = result.Description; 412 r.AlgorithmId = algorithmId; 413 r.DataTypeId = ConvertToDataType(result.DataType).Id; 414 r.Store(); 415 results.Add(r); 416 } 417 } 418 return values; 366 419 } 367 420 #endregion -
branches/OKB/HeuristicLab.Clients.OKB-3.3/OKBExperiment.cs
r4587 r4591 320 320 private void Runs_ItemsAdded(object sender, Collections.CollectionItemsChangedEventArgs<IRun> e) { 321 321 try { 322 foreach ( Run run in e.Items)322 foreach (HeuristicLab.Optimization.Run run in e.Items) 323 323 OKBClient.Instance.AddRun(AlgorithmId, ProblemId, run); 324 324 } -
branches/OKB/HeuristicLab.Clients.OKB-3.3/ServiceClients/OKBServiceClient.cs
r4587 r4591 15 15 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 16 16 [System.Runtime.Serialization.DataContractAttribute(Name = "OKBItem", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.OKB.DataTransfer")] 17 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.Experiment))] 18 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.Run))] 17 19 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.DataType))] 18 20 [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Clients.OKB.NamedOKBItem))] … … 58 60 [System.Diagnostics.DebuggerStepThroughAttribute()] 59 61 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 62 [System.Runtime.Serialization.DataContractAttribute(Name = "Experiment", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.OKB.DataTransfer")] 63 public partial class Experiment : HeuristicLab.Clients.OKB.OKBItem { 64 65 private long AlgorithmIdField; 66 67 private HeuristicLab.Clients.OKB.AlgorithmParameterValue[] AlgorithmParameterValuesField; 68 69 private long ProblemIdField; 70 71 private HeuristicLab.Clients.OKB.ProblemParameterValue[] ProblemParameterValuesField; 72 73 [System.Runtime.Serialization.DataMemberAttribute()] 74 public long AlgorithmId { 75 get { 76 return this.AlgorithmIdField; 77 } 78 set { 79 if ((this.AlgorithmIdField.Equals(value) != true)) { 80 this.AlgorithmIdField = value; 81 this.RaisePropertyChanged("AlgorithmId"); 82 } 83 } 84 } 85 86 [System.Runtime.Serialization.DataMemberAttribute()] 87 public HeuristicLab.Clients.OKB.AlgorithmParameterValue[] AlgorithmParameterValues { 88 get { 89 return this.AlgorithmParameterValuesField; 90 } 91 set { 92 if ((object.ReferenceEquals(this.AlgorithmParameterValuesField, value) != true)) { 93 this.AlgorithmParameterValuesField = value; 94 this.RaisePropertyChanged("AlgorithmParameterValues"); 95 } 96 } 97 } 98 99 [System.Runtime.Serialization.DataMemberAttribute()] 100 public long ProblemId { 101 get { 102 return this.ProblemIdField; 103 } 104 set { 105 if ((this.ProblemIdField.Equals(value) != true)) { 106 this.ProblemIdField = value; 107 this.RaisePropertyChanged("ProblemId"); 108 } 109 } 110 } 111 112 [System.Runtime.Serialization.DataMemberAttribute()] 113 public HeuristicLab.Clients.OKB.ProblemParameterValue[] ProblemParameterValues { 114 get { 115 return this.ProblemParameterValuesField; 116 } 117 set { 118 if ((object.ReferenceEquals(this.ProblemParameterValuesField, value) != true)) { 119 this.ProblemParameterValuesField = value; 120 this.RaisePropertyChanged("ProblemParameterValues"); 121 } 122 } 123 } 124 } 125 126 [System.Diagnostics.DebuggerStepThroughAttribute()] 127 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 128 [System.Runtime.Serialization.DataContractAttribute(Name = "Run", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.OKB.DataTransfer")] 129 public partial class Run : HeuristicLab.Clients.OKB.OKBItem { 130 131 private System.Guid ClientIdField; 132 133 private long ExperimentIdField; 134 135 private System.Nullable<System.DateTime> FinishedDateField; 136 137 private int RandomSeedField; 138 139 private HeuristicLab.Clients.OKB.ResultValue[] ResultValuesField; 140 141 private System.Guid UserIdField; 142 143 [System.Runtime.Serialization.DataMemberAttribute()] 144 public System.Guid ClientId { 145 get { 146 return this.ClientIdField; 147 } 148 set { 149 if ((this.ClientIdField.Equals(value) != true)) { 150 this.ClientIdField = value; 151 this.RaisePropertyChanged("ClientId"); 152 } 153 } 154 } 155 156 [System.Runtime.Serialization.DataMemberAttribute()] 157 public long ExperimentId { 158 get { 159 return this.ExperimentIdField; 160 } 161 set { 162 if ((this.ExperimentIdField.Equals(value) != true)) { 163 this.ExperimentIdField = value; 164 this.RaisePropertyChanged("ExperimentId"); 165 } 166 } 167 } 168 169 [System.Runtime.Serialization.DataMemberAttribute()] 170 public System.Nullable<System.DateTime> FinishedDate { 171 get { 172 return this.FinishedDateField; 173 } 174 set { 175 if ((this.FinishedDateField.Equals(value) != true)) { 176 this.FinishedDateField = value; 177 this.RaisePropertyChanged("FinishedDate"); 178 } 179 } 180 } 181 182 [System.Runtime.Serialization.DataMemberAttribute()] 183 public int RandomSeed { 184 get { 185 return this.RandomSeedField; 186 } 187 set { 188 if ((this.RandomSeedField.Equals(value) != true)) { 189 this.RandomSeedField = value; 190 this.RaisePropertyChanged("RandomSeed"); 191 } 192 } 193 } 194 195 [System.Runtime.Serialization.DataMemberAttribute()] 196 public HeuristicLab.Clients.OKB.ResultValue[] ResultValues { 197 get { 198 return this.ResultValuesField; 199 } 200 set { 201 if ((object.ReferenceEquals(this.ResultValuesField, value) != true)) { 202 this.ResultValuesField = value; 203 this.RaisePropertyChanged("ResultValues"); 204 } 205 } 206 } 207 208 [System.Runtime.Serialization.DataMemberAttribute()] 209 public System.Guid UserId { 210 get { 211 return this.UserIdField; 212 } 213 set { 214 if ((this.UserIdField.Equals(value) != true)) { 215 this.UserIdField = value; 216 this.RaisePropertyChanged("UserId"); 217 } 218 } 219 } 220 } 221 222 [System.Diagnostics.DebuggerStepThroughAttribute()] 223 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 60 224 [System.Runtime.Serialization.DataContractAttribute(Name = "DataType", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.OKB.DataTransfer")] 61 225 public partial class DataType : HeuristicLab.Clients.OKB.OKBItem { … … 396 560 [System.Diagnostics.DebuggerStepThroughAttribute()] 397 561 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 398 [System.Runtime.Serialization.DataContractAttribute(Name = " ProblemData", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.OKB.DataTransfer")]399 public partial class ProblemData: object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged {562 [System.Runtime.Serialization.DataContractAttribute(Name = "AlgorithmParameterValue", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.OKB.DataTransfer")] 563 public partial class AlgorithmParameterValue : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { 400 564 401 565 private System.Runtime.Serialization.ExtensionDataObject extensionDataField; 402 566 403 private byte[] DataField;567 private long AlgorithmParameterIdField; 404 568 405 569 private long DataTypeIdField; 406 570 407 private long ProblemIdField;571 private long ExperimentIdField; 408 572 409 573 public System.Runtime.Serialization.ExtensionDataObject ExtensionData { … … 417 581 418 582 [System.Runtime.Serialization.DataMemberAttribute()] 419 public byte[] Data{420 get { 421 return this. DataField;422 } 423 set { 424 if (( object.ReferenceEquals(this.DataField,value) != true)) {425 this. DataField = value;426 this.RaisePropertyChanged(" Data");583 public long AlgorithmParameterId { 584 get { 585 return this.AlgorithmParameterIdField; 586 } 587 set { 588 if ((this.AlgorithmParameterIdField.Equals(value) != true)) { 589 this.AlgorithmParameterIdField = value; 590 this.RaisePropertyChanged("AlgorithmParameterId"); 427 591 } 428 592 } … … 443 607 444 608 [System.Runtime.Serialization.DataMemberAttribute()] 445 public long ProblemId {446 get { 447 return this. ProblemIdField;448 } 449 set { 450 if ((this. ProblemIdField.Equals(value) != true)) {451 this. ProblemIdField = value;452 this.RaisePropertyChanged(" ProblemId");609 public long ExperimentId { 610 get { 611 return this.ExperimentIdField; 612 } 613 set { 614 if ((this.ExperimentIdField.Equals(value) != true)) { 615 this.ExperimentIdField = value; 616 this.RaisePropertyChanged("ExperimentId"); 453 617 } 454 618 } … … 467 631 [System.Diagnostics.DebuggerStepThroughAttribute()] 468 632 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 469 [System.Runtime.Serialization.DataContractAttribute(Name = " AlgorithmData", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.OKB.DataTransfer")]470 public partial class AlgorithmData: object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged {633 [System.Runtime.Serialization.DataContractAttribute(Name = "ProblemParameterValue", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.OKB.DataTransfer")] 634 public partial class ProblemParameterValue : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { 471 635 472 636 private System.Runtime.Serialization.ExtensionDataObject extensionDataField; 473 637 474 private long AlgorithmIdField;475 476 private byte[] DataField;477 478 638 private long DataTypeIdField; 479 639 640 private long ExperimentIdField; 641 642 private long ProblemParameterIdField; 643 480 644 public System.Runtime.Serialization.ExtensionDataObject ExtensionData { 481 645 get { … … 484 648 set { 485 649 this.extensionDataField = value; 486 }487 }488 489 [System.Runtime.Serialization.DataMemberAttribute()]490 public long AlgorithmId {491 get {492 return this.AlgorithmIdField;493 }494 set {495 if ((this.AlgorithmIdField.Equals(value) != true)) {496 this.AlgorithmIdField = value;497 this.RaisePropertyChanged("AlgorithmId");498 }499 }500 }501 502 [System.Runtime.Serialization.DataMemberAttribute()]503 public byte[] Data {504 get {505 return this.DataField;506 }507 set {508 if ((object.ReferenceEquals(this.DataField, value) != true)) {509 this.DataField = value;510 this.RaisePropertyChanged("Data");511 }512 650 } 513 651 } … … 522 660 this.DataTypeIdField = value; 523 661 this.RaisePropertyChanged("DataTypeId"); 662 } 663 } 664 } 665 666 [System.Runtime.Serialization.DataMemberAttribute()] 667 public long ExperimentId { 668 get { 669 return this.ExperimentIdField; 670 } 671 set { 672 if ((this.ExperimentIdField.Equals(value) != true)) { 673 this.ExperimentIdField = value; 674 this.RaisePropertyChanged("ExperimentId"); 675 } 676 } 677 } 678 679 [System.Runtime.Serialization.DataMemberAttribute()] 680 public long ProblemParameterId { 681 get { 682 return this.ProblemParameterIdField; 683 } 684 set { 685 if ((this.ProblemParameterIdField.Equals(value) != true)) { 686 this.ProblemParameterIdField = value; 687 this.RaisePropertyChanged("ProblemParameterId"); 524 688 } 525 689 } … … 536 700 } 537 701 702 [System.Diagnostics.DebuggerStepThroughAttribute()] 703 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 704 [System.Runtime.Serialization.DataContractAttribute(Name = "ResultValue", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.OKB.DataTransfer")] 705 public partial class ResultValue : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { 706 707 private System.Runtime.Serialization.ExtensionDataObject extensionDataField; 708 709 private long DataTypeIdField; 710 711 private long ResultIdField; 712 713 private long RunIdField; 714 715 public System.Runtime.Serialization.ExtensionDataObject ExtensionData { 716 get { 717 return this.extensionDataField; 718 } 719 set { 720 this.extensionDataField = value; 721 } 722 } 723 724 [System.Runtime.Serialization.DataMemberAttribute()] 725 public long DataTypeId { 726 get { 727 return this.DataTypeIdField; 728 } 729 set { 730 if ((this.DataTypeIdField.Equals(value) != true)) { 731 this.DataTypeIdField = value; 732 this.RaisePropertyChanged("DataTypeId"); 733 } 734 } 735 } 736 737 [System.Runtime.Serialization.DataMemberAttribute()] 738 public long ResultId { 739 get { 740 return this.ResultIdField; 741 } 742 set { 743 if ((this.ResultIdField.Equals(value) != true)) { 744 this.ResultIdField = value; 745 this.RaisePropertyChanged("ResultId"); 746 } 747 } 748 } 749 750 [System.Runtime.Serialization.DataMemberAttribute()] 751 public long RunId { 752 get { 753 return this.RunIdField; 754 } 755 set { 756 if ((this.RunIdField.Equals(value) != true)) { 757 this.RunIdField = value; 758 this.RaisePropertyChanged("RunId"); 759 } 760 } 761 } 762 763 public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; 764 765 protected void RaisePropertyChanged(string propertyName) { 766 System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; 767 if ((propertyChanged != null)) { 768 propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); 769 } 770 } 771 } 772 773 [System.Diagnostics.DebuggerStepThroughAttribute()] 774 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 775 [System.Runtime.Serialization.DataContractAttribute(Name = "ProblemData", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.OKB.DataTransfer")] 776 public partial class ProblemData : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { 777 778 private System.Runtime.Serialization.ExtensionDataObject extensionDataField; 779 780 private byte[] DataField; 781 782 private long DataTypeIdField; 783 784 private long ProblemIdField; 785 786 public System.Runtime.Serialization.ExtensionDataObject ExtensionData { 787 get { 788 return this.extensionDataField; 789 } 790 set { 791 this.extensionDataField = value; 792 } 793 } 794 795 [System.Runtime.Serialization.DataMemberAttribute()] 796 public byte[] Data { 797 get { 798 return this.DataField; 799 } 800 set { 801 if ((object.ReferenceEquals(this.DataField, value) != true)) { 802 this.DataField = value; 803 this.RaisePropertyChanged("Data"); 804 } 805 } 806 } 807 808 [System.Runtime.Serialization.DataMemberAttribute()] 809 public long DataTypeId { 810 get { 811 return this.DataTypeIdField; 812 } 813 set { 814 if ((this.DataTypeIdField.Equals(value) != true)) { 815 this.DataTypeIdField = value; 816 this.RaisePropertyChanged("DataTypeId"); 817 } 818 } 819 } 820 821 [System.Runtime.Serialization.DataMemberAttribute()] 822 public long ProblemId { 823 get { 824 return this.ProblemIdField; 825 } 826 set { 827 if ((this.ProblemIdField.Equals(value) != true)) { 828 this.ProblemIdField = value; 829 this.RaisePropertyChanged("ProblemId"); 830 } 831 } 832 } 833 834 public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; 835 836 protected void RaisePropertyChanged(string propertyName) { 837 System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; 838 if ((propertyChanged != null)) { 839 propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); 840 } 841 } 842 } 843 844 [System.Diagnostics.DebuggerStepThroughAttribute()] 845 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] 846 [System.Runtime.Serialization.DataContractAttribute(Name = "AlgorithmData", Namespace = "http://schemas.datacontract.org/2004/07/HeuristicLab.Services.OKB.DataTransfer")] 847 public partial class AlgorithmData : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { 848 849 private System.Runtime.Serialization.ExtensionDataObject extensionDataField; 850 851 private long AlgorithmIdField; 852 853 private byte[] DataField; 854 855 private long DataTypeIdField; 856 857 public System.Runtime.Serialization.ExtensionDataObject ExtensionData { 858 get { 859 return this.extensionDataField; 860 } 861 set { 862 this.extensionDataField = value; 863 } 864 } 865 866 [System.Runtime.Serialization.DataMemberAttribute()] 867 public long AlgorithmId { 868 get { 869 return this.AlgorithmIdField; 870 } 871 set { 872 if ((this.AlgorithmIdField.Equals(value) != true)) { 873 this.AlgorithmIdField = value; 874 this.RaisePropertyChanged("AlgorithmId"); 875 } 876 } 877 } 878 879 [System.Runtime.Serialization.DataMemberAttribute()] 880 public byte[] Data { 881 get { 882 return this.DataField; 883 } 884 set { 885 if ((object.ReferenceEquals(this.DataField, value) != true)) { 886 this.DataField = value; 887 this.RaisePropertyChanged("Data"); 888 } 889 } 890 } 891 892 [System.Runtime.Serialization.DataMemberAttribute()] 893 public long DataTypeId { 894 get { 895 return this.DataTypeIdField; 896 } 897 set { 898 if ((this.DataTypeIdField.Equals(value) != true)) { 899 this.DataTypeIdField = value; 900 this.RaisePropertyChanged("DataTypeId"); 901 } 902 } 903 } 904 905 public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; 906 907 protected void RaisePropertyChanged(string propertyName) { 908 System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; 909 if ((propertyChanged != null)) { 910 propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); 911 } 912 } 913 } 914 538 915 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] 539 916 [System.ServiceModel.ServiceContractAttribute(ConfigurationName = "HeuristicLab.Clients.OKB.IOKBService")] … … 549 926 void DeleteResult(long id); 550 927 928 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/GetExperiment", ReplyAction = "http://tempuri.org/IOKBService/GetExperimentResponse")] 929 HeuristicLab.Clients.OKB.Experiment GetExperiment(long id); 930 931 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/GetExperiments", ReplyAction = "http://tempuri.org/IOKBService/GetExperimentsResponse")] 932 HeuristicLab.Clients.OKB.Experiment[] GetExperiments(long algorithmId, long problemId); 933 934 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/AddExperiment", ReplyAction = "http://tempuri.org/IOKBService/AddExperimentResponse")] 935 long AddExperiment(HeuristicLab.Clients.OKB.Experiment dto); 936 937 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/DeleteExperiment", ReplyAction = "http://tempuri.org/IOKBService/DeleteExperimentResponse")] 938 void DeleteExperiment(long id); 939 940 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/GetRun", ReplyAction = "http://tempuri.org/IOKBService/GetRunResponse")] 941 HeuristicLab.Clients.OKB.Run GetRun(long id); 942 943 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/GetRuns", ReplyAction = "http://tempuri.org/IOKBService/GetRunsResponse")] 944 HeuristicLab.Clients.OKB.Run[] GetRuns(long experimentId); 945 946 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/AddRun", ReplyAction = "http://tempuri.org/IOKBService/AddRunResponse")] 947 long AddRun(HeuristicLab.Clients.OKB.Run dto); 948 949 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/DeleteRun", ReplyAction = "http://tempuri.org/IOKBService/DeleteRunResponse")] 950 void DeleteRun(long id); 951 551 952 [System.ServiceModel.OperationContractAttribute(Action = "http://tempuri.org/IOKBService/GetAlgorithmParameters", ReplyAction = "http://tempuri.org/IOKBService/GetAlgorithmParametersResponse")] 552 953 HeuristicLab.Clients.OKB.AlgorithmParameter[] GetAlgorithmParameters(long algorithmId); … … 739 1140 } 740 1141 1142 public HeuristicLab.Clients.OKB.Experiment GetExperiment(long id) { 1143 return base.Channel.GetExperiment(id); 1144 } 1145 1146 public HeuristicLab.Clients.OKB.Experiment[] GetExperiments(long algorithmId, long problemId) { 1147 return base.Channel.GetExperiments(algorithmId, problemId); 1148 } 1149 1150 public long AddExperiment(HeuristicLab.Clients.OKB.Experiment dto) { 1151 return base.Channel.AddExperiment(dto); 1152 } 1153 1154 public void DeleteExperiment(long id) { 1155 base.Channel.DeleteExperiment(id); 1156 } 1157 1158 public HeuristicLab.Clients.OKB.Run GetRun(long id) { 1159 return base.Channel.GetRun(id); 1160 } 1161 1162 public HeuristicLab.Clients.OKB.Run[] GetRuns(long experimentId) { 1163 return base.Channel.GetRuns(experimentId); 1164 } 1165 1166 public long AddRun(HeuristicLab.Clients.OKB.Run dto) { 1167 return base.Channel.AddRun(dto); 1168 } 1169 1170 public void DeleteRun(long id) { 1171 base.Channel.DeleteRun(id); 1172 } 1173 741 1174 public HeuristicLab.Clients.OKB.AlgorithmParameter[] GetAlgorithmParameters(long algorithmId) { 742 1175 return base.Channel.GetAlgorithmParameters(algorithmId); -
branches/OKB/HeuristicLab.Clients.OKB-3.3/app.config
r4549 r4591 7 7 openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 8 8 bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" 9 maxBufferPoolSize="524288" maxReceivedMessageSize=" 200000000"9 maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 10 10 messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 11 11 allowCookies="false"> 12 <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength=" 200000000"12 <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 13 13 maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 14 14 <reliableSession ordered="true" inactivityTimeout="00:10:00" -
branches/OKB/HeuristicLab.Services.OKB.DataAccess/3.3/OKB.dbml
r4481 r4591 140 140 <Association Name="Run_ResultStringValue" Member="ResultStringValues" ThisKey="Id" OtherKey="RunId" Type="ResultStringValue" /> 141 141 <Association Name="Experiment_Run" Member="Experiment" ThisKey="ExperimentId" OtherKey="Id" Type="Experiment" IsForeignKey="true" /> 142 <Association Name="Client_Run" Member="Client" ThisKey="ClientId" OtherKey="Id" Type="Client" IsForeignKey="true" />143 142 </Type> 144 143 </Table> … … 158 157 <Association Name="Algorithm_Result" Member="Algorithm" ThisKey="AlgorithmId" OtherKey="Id" Type="Algorithm" IsForeignKey="true" /> 159 158 <Association Name="DataType_Result" Member="DataType" ThisKey="DataTypeId" OtherKey="Id" Type="DataType" IsForeignKey="true" /> 160 </Type>161 </Table>162 <Table Name="dbo.Client" Member="Clients">163 <Type Name="Client">164 <Column Name="Id" Type="System.Guid" DbType="UniqueIdentifier NOT NULL" IsPrimaryKey="true" CanBeNull="false" />165 <Column Name="Name" Type="System.String" DbType="NVarChar(200) NOT NULL" CanBeNull="false" />166 <Association Name="Client_Run" Member="Runs" ThisKey="Id" OtherKey="ClientId" Type="Run" />167 159 </Type> 168 160 </Table> -
branches/OKB/HeuristicLab.Services.OKB.DataAccess/3.3/OKB.dbml.layout
r4481 r4591 34 34 </nestedChildShapes> 35 35 </classShape> 36 <associationConnector edgePoints="[(14.25 : 1.8862939453125); (14.25 : 2.125)]" fixedFrom=" Algorithm" fixedTo="Algorithm">36 <associationConnector edgePoints="[(14.25 : 1.8862939453125); (14.25 : 2.125)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 37 37 <AssociationMoniker Name="/OKBDataContext/ProblemClass/ProblemClass_Problem" /> 38 38 <nodes> … … 47 47 </nestedChildShapes> 48 48 </classShape> 49 <associationConnector edgePoints="[(13.25 : 3.73768854532225); (10.3177083333333 : 3.73768854532225 : JumpStart); (10.0755208333334 : 3.73768854532225 : JumpEnd); (9.39129711009978 : 3.73768854532225); (9.39129711009978 : 4.375)]" manuallyRouted="true" fixedFrom=" Caller" fixedTo="Algorithm">49 <associationConnector edgePoints="[(13.25 : 3.73768854532225); (10.3177083333333 : 3.73768854532225 : JumpStart); (10.0755208333334 : 3.73768854532225 : JumpEnd); (9.39129711009978 : 3.73768854532225); (9.39129711009978 : 4.375)]" manuallyRouted="true" fixedFrom="NotFixed" fixedTo="NotFixed"> 50 50 <AssociationMoniker Name="/OKBDataContext/Problem/Problem_Experiment" /> 51 51 <nodes> … … 73 73 </nestedChildShapes> 74 74 </classShape> 75 <associationConnector edgePoints="[(14.25 : 3.89589680989583); (14.25 : 4.375)]" fixedFrom=" Algorithm" fixedTo="Algorithm">75 <associationConnector edgePoints="[(14.25 : 3.89589680989583); (14.25 : 4.375)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 76 76 <AssociationMoniker Name="/OKBDataContext/Problem/Problem_ProblemParameter" /> 77 77 <nodes> … … 119 119 </nodes> 120 120 </associationConnector> 121 <associationConnector edgePoints="[(10 : 2.85); (13.25 : 2.85)]" fixedFrom=" Algorithm" fixedTo="Algorithm">121 <associationConnector edgePoints="[(10 : 2.85); (13.25 : 2.85)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 122 122 <AssociationMoniker Name="/OKBDataContext/Platform/Platform_Problem" /> 123 123 <nodes> … … 159 159 </nodes> 160 160 </associationConnector> 161 <classShape Id="8b301cad-7a91-46f5-9c49-75b17bac7a67" absoluteBounds="11.75, 10.25, 2, 1.1939925130208344">162 <DataClassMoniker Name="/OKBDataContext/Client" />163 <nestedChildShapes>164 <elementListCompartment Id="aacc92af-97a1-46b2-8614-a54b03736b54" absoluteBounds="11.765, 10.71, 1.9700000000000002, 0.63399251302083326" name="DataPropertiesCompartment" titleTextColor="Black" itemTextColor="Black" />165 </nestedChildShapes>166 </classShape>167 <associationConnector edgePoints="[(11.75 : 10.8469962565104); (10 : 10.8469962565104)]" fixedFrom="NotFixed" fixedTo="NotFixed">168 <AssociationMoniker Name="/OKBDataContext/Client/Client_Run" />169 <nodes>170 <classShapeMoniker Id="8b301cad-7a91-46f5-9c49-75b17bac7a67" />171 <classShapeMoniker Id="83a5f628-defe-486f-bc6a-4ab430293368" />172 </nodes>173 </associationConnector>174 161 <classShape Id="06cdd7a7-aece-4230-94df-523959acef3f" isExpanded="false" absoluteBounds="5, 4.375, 2, 0.45"> 175 162 <DataClassMoniker Name="/OKBDataContext/AlgorithmParameterBlobValue" /> … … 361 348 </nodes> 362 349 </associationConnector> 363 <associationConnector edgePoints="[(13.25 : 4.6); (13 : 4.6)]" fixedFrom=" Algorithm" fixedTo="Algorithm">350 <associationConnector edgePoints="[(13.25 : 4.6); (13 : 4.6)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 364 351 <AssociationMoniker Name="/OKBDataContext/ProblemParameter/ProblemParameter_ProblemParameterBlobValue" /> 365 352 <nodes> … … 644 631 </nodes> 645 632 </associationConnector> 646 <associationConnector edgePoints="[(13.25 : 3.27707098556576); (13 : 3.27707098556576)]" fixedFrom=" Algorithm" fixedTo="Algorithm">633 <associationConnector edgePoints="[(13.25 : 3.27707098556576); (13 : 3.27707098556576)]" fixedFrom="NotFixed" fixedTo="NotFixed"> 647 634 <AssociationMoniker Name="/OKBDataContext/Problem/Problem_ProblemData" /> 648 635 <nodes> -
branches/OKB/HeuristicLab.Services.OKB.DataTransfer/3.3/Experiment.cs
r4559 r4591 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using System.Runtime.Serialization; 23 24 … … 29 30 [DataMember] 30 31 public long ProblemId { get; set; } 32 [DataMember] 33 public IEnumerable<AlgorithmParameterValue> AlgorithmParameterValues { get; set; } 34 [DataMember] 35 public IEnumerable<ProblemParameterValue> ProblemParameterValues { get; set; } 31 36 } 32 37 } -
branches/OKB/HeuristicLab.Services.OKB.DataTransfer/3.3/HeuristicLab.Services.OKB.DataTransfer-3.3.csproj
r4559 r4591 52 52 <Compile Include="AlgorithmData.cs" /> 53 53 <Compile Include="AlgorithmParameter.cs" /> 54 <Compile Include="AlgorithmParameterValue.cs" /> 55 <Compile Include="AlgorithmParameterBlobValue.cs" /> 56 <Compile Include="AlgorithmParameterBoolValue.cs" /> 57 <Compile Include="AlgorithmParameterFloatValue.cs" /> 58 <Compile Include="AlgorithmParameterIntValue.cs" /> 59 <Compile Include="AlgorithmParameterStringValue.cs" /> 60 <Compile Include="ResultFloatValue.cs" /> 61 <Compile Include="ResultBoolValue.cs" /> 62 <Compile Include="ResultIntValue.cs" /> 63 <Compile Include="ResultStringValue.cs" /> 64 <Compile Include="ResultBlobValue.cs" /> 65 <Compile Include="ProblemParameterBoolValue.cs" /> 66 <Compile Include="ProblemParameterFloatValue.cs" /> 67 <Compile Include="ProblemParameterIntValue.cs" /> 68 <Compile Include="ProblemParameterStringValue.cs" /> 69 <Compile Include="ProblemParameterBlobValue.cs" /> 70 <Compile Include="ResultValue.cs" /> 71 <Compile Include="ProblemParameterValue.cs" /> 54 72 <Compile Include="Run.cs" /> 55 73 <Compile Include="Experiment.cs" /> -
branches/OKB/HeuristicLab.Services.OKB.DataTransfer/3.3/Run.cs
r4559 r4591 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.Runtime.Serialization; 24 25 … … 36 37 [DataMember] 37 38 public Guid ClientId { get; set; } 39 [DataMember] 40 public IEnumerable<ResultValue> ResultValues { get; set; } 38 41 } 39 42 } -
branches/OKB/HeuristicLab.Services.OKB/3.3/Convert.cs
r4559 r4591 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using System.Data.Linq; 24 using System.Linq; 23 25 using DA = HeuristicLab.Services.OKB.DataAccess; 24 26 using DT = HeuristicLab.Services.OKB.DataTransfer; … … 36 38 } 37 39 public static void ToEntity(DT.Platform source, DA.Platform target) { 38 if ((source != null) && (target != null)) 40 if ((source != null) && (target != null)) { 39 41 target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; 42 } 40 43 } 41 44 #endregion … … 51 54 } 52 55 public static void ToEntity(DT.DataType source, DA.DataType target) { 53 if ((source != null) && (target != null)) 56 if ((source != null) && (target != null)) { 54 57 target.Id = source.Id; target.Name = source.Name; target.SqlName = source.SqlName; target.PlatformId = source.PlatformId; 58 } 55 59 } 56 60 #endregion … … 66 70 } 67 71 public static void ToEntity(DT.AlgorithmClass source, DA.AlgorithmClass target) { 68 if ((source != null) && (target != null)) 72 if ((source != null) && (target != null)) { 69 73 target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; 74 } 70 75 } 71 76 #endregion … … 81 86 } 82 87 public static void ToEntity(DT.Algorithm source, DA.Algorithm target) { 83 if ((source != null) && (target != null)) 88 if ((source != null) && (target != null)) { 84 89 target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.PlatformId = source.PlatformId; target.AlgorithmClassId = source.AlgorithmClassId; 90 } 85 91 } 86 92 #endregion … … 96 102 } 97 103 public static void ToEntity(DT.AlgorithmData source, DA.AlgorithmData target) { 98 if ((source != null) && (target != null)) 104 if ((source != null) && (target != null)) { 99 105 target.AlgorithmId = source.AlgorithmId; target.DataTypeId = source.DataTypeId; target.Data = new Binary(source.Data); 106 } 100 107 } 101 108 #endregion … … 111 118 } 112 119 public static void ToEntity(DT.AlgorithmParameter source, DA.AlgorithmParameter target) { 113 if ((source != null) && (target != null)) 120 if ((source != null) && (target != null)) { 114 121 target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.Alias = source.Alias; target.AlgorithmId = source.AlgorithmId; target.DataTypeId = source.DataTypeId; 122 } 123 } 124 #endregion 125 126 #region AlgorithmParameterBlobValue 127 public static DT.AlgorithmParameterBlobValue ToDto(DA.AlgorithmParameterBlobValue source) { 128 if (source == null) return null; 129 return new DT.AlgorithmParameterBlobValue { AlgorithmParameterId = source.AlgorithmParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value.ToArray() }; 130 } 131 public static DA.AlgorithmParameterBlobValue ToEntity(DT.AlgorithmParameterBlobValue source) { 132 if (source == null) return null; 133 return new DA.AlgorithmParameterBlobValue { AlgorithmParameterId = source.AlgorithmParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = new Binary(source.Value) }; 134 } 135 public static void ToEntity(DT.AlgorithmParameterBlobValue source, DA.AlgorithmParameterBlobValue target) { 136 if ((source != null) && (target != null)) { 137 target.AlgorithmParameterId = source.AlgorithmParameterId; target.ExperimentId = source.ExperimentId; target.DataTypeId = source.DataTypeId; target.Value = new Binary(source.Value); 138 } 139 } 140 #endregion 141 142 #region AlgorithmParameterBoolValue 143 public static DT.AlgorithmParameterBoolValue ToDto(DA.AlgorithmParameterBoolValue source) { 144 if (source == null) return null; 145 return new DT.AlgorithmParameterBoolValue { AlgorithmParameterId = source.AlgorithmParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value }; 146 } 147 public static DA.AlgorithmParameterBoolValue ToEntity(DT.AlgorithmParameterBoolValue source) { 148 if (source == null) return null; 149 return new DA.AlgorithmParameterBoolValue { AlgorithmParameterId = source.AlgorithmParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value }; 150 } 151 public static void ToEntity(DT.AlgorithmParameterBoolValue source, DA.AlgorithmParameterBoolValue target) { 152 if ((source != null) && (target != null)) { 153 target.AlgorithmParameterId = source.AlgorithmParameterId; target.ExperimentId = source.ExperimentId; target.DataTypeId = source.DataTypeId; target.Value = source.Value; 154 } 155 } 156 #endregion 157 158 #region AlgorithmParameterFloatValue 159 public static DT.AlgorithmParameterFloatValue ToDto(DA.AlgorithmParameterFloatValue source) { 160 if (source == null) return null; 161 return new DT.AlgorithmParameterFloatValue { AlgorithmParameterId = source.AlgorithmParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value }; 162 } 163 public static DA.AlgorithmParameterFloatValue ToEntity(DT.AlgorithmParameterFloatValue source) { 164 if (source == null) return null; 165 return new DA.AlgorithmParameterFloatValue { AlgorithmParameterId = source.AlgorithmParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value }; 166 } 167 public static void ToEntity(DT.AlgorithmParameterFloatValue source, DA.AlgorithmParameterFloatValue target) { 168 if ((source != null) && (target != null)) { 169 target.AlgorithmParameterId = source.AlgorithmParameterId; target.ExperimentId = source.ExperimentId; target.DataTypeId = source.DataTypeId; target.Value = source.Value; 170 } 171 } 172 #endregion 173 174 #region AlgorithmParameterIntValue 175 public static DT.AlgorithmParameterIntValue ToDto(DA.AlgorithmParameterIntValue source) { 176 if (source == null) return null; 177 return new DT.AlgorithmParameterIntValue { AlgorithmParameterId = source.AlgorithmParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value }; 178 } 179 public static DA.AlgorithmParameterIntValue ToEntity(DT.AlgorithmParameterIntValue source) { 180 if (source == null) return null; 181 return new DA.AlgorithmParameterIntValue { AlgorithmParameterId = source.AlgorithmParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value }; 182 } 183 public static void ToEntity(DT.AlgorithmParameterIntValue source, DA.AlgorithmParameterIntValue target) { 184 if ((source != null) && (target != null)) { 185 target.AlgorithmParameterId = source.AlgorithmParameterId; target.ExperimentId = source.ExperimentId; target.DataTypeId = source.DataTypeId; target.Value = source.Value; 186 } 187 } 188 #endregion 189 190 #region AlgorithmParameterStringValue 191 public static DT.AlgorithmParameterStringValue ToDto(DA.AlgorithmParameterStringValue source) { 192 if (source == null) return null; 193 return new DT.AlgorithmParameterStringValue { AlgorithmParameterId = source.AlgorithmParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value }; 194 } 195 public static DA.AlgorithmParameterStringValue ToEntity(DT.AlgorithmParameterStringValue source) { 196 if (source == null) return null; 197 return new DA.AlgorithmParameterStringValue { AlgorithmParameterId = source.AlgorithmParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value }; 198 } 199 public static void ToEntity(DT.AlgorithmParameterStringValue source, DA.AlgorithmParameterStringValue target) { 200 if ((source != null) && (target != null)) { 201 target.AlgorithmParameterId = source.AlgorithmParameterId; target.ExperimentId = source.ExperimentId; target.DataTypeId = source.DataTypeId; target.Value = source.Value; 202 } 115 203 } 116 204 #endregion … … 126 214 } 127 215 public static void ToEntity(DT.ProblemClass source, DA.ProblemClass target) { 128 if ((source != null) && (target != null)) 216 if ((source != null) && (target != null)) { 129 217 target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; 218 } 130 219 } 131 220 #endregion … … 141 230 } 142 231 public static void ToEntity(DT.Problem source, DA.Problem target) { 143 if ((source != null) && (target != null)) 232 if ((source != null) && (target != null)) { 144 233 target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.PlatformId = source.PlatformId; target.ProblemClassId = source.ProblemClassId; 234 } 145 235 } 146 236 #endregion … … 156 246 } 157 247 public static void ToEntity(DT.ProblemData source, DA.ProblemData target) { 158 if ((source != null) && (target != null)) 248 if ((source != null) && (target != null)) { 159 249 target.ProblemId = source.ProblemId; target.DataTypeId = source.DataTypeId; target.Data = new Binary(source.Data); 250 } 160 251 } 161 252 #endregion … … 171 262 } 172 263 public static void ToEntity(DT.ProblemParameter source, DA.ProblemParameter target) { 173 if ((source != null) && (target != null)) 264 if ((source != null) && (target != null)) { 174 265 target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.Alias = source.Alias; target.ProblemId = source.ProblemId; target.DataTypeId = source.DataTypeId; 266 } 267 } 268 #endregion 269 270 #region ProblemParameterBlobValue 271 public static DT.ProblemParameterBlobValue ToDto(DA.ProblemParameterBlobValue source) { 272 if (source == null) return null; 273 return new DT.ProblemParameterBlobValue { ProblemParameterId = source.ProblemParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value.ToArray() }; 274 } 275 public static DA.ProblemParameterBlobValue ToEntity(DT.ProblemParameterBlobValue source) { 276 if (source == null) return null; 277 return new DA.ProblemParameterBlobValue { ProblemParameterId = source.ProblemParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = new Binary(source.Value) }; 278 } 279 public static void ToEntity(DT.ProblemParameterBlobValue source, DA.ProblemParameterBlobValue target) { 280 if ((source != null) && (target != null)) { 281 target.ProblemParameterId = source.ProblemParameterId; target.ExperimentId = source.ExperimentId; target.DataTypeId = source.DataTypeId; target.Value = new Binary(source.Value); 282 } 283 } 284 #endregion 285 286 #region ProblemParameterBoolValue 287 public static DT.ProblemParameterBoolValue ToDto(DA.ProblemParameterBoolValue source) { 288 if (source == null) return null; 289 return new DT.ProblemParameterBoolValue { ProblemParameterId = source.ProblemParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value }; 290 } 291 public static DA.ProblemParameterBoolValue ToEntity(DT.ProblemParameterBoolValue source) { 292 if (source == null) return null; 293 return new DA.ProblemParameterBoolValue { ProblemParameterId = source.ProblemParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value }; 294 } 295 public static void ToEntity(DT.ProblemParameterBoolValue source, DA.ProblemParameterBoolValue target) { 296 if ((source != null) && (target != null)) { 297 target.ProblemParameterId = source.ProblemParameterId; target.ExperimentId = source.ExperimentId; target.DataTypeId = source.DataTypeId; target.Value = source.Value; 298 } 299 } 300 #endregion 301 302 #region ProblemParameterFloatValue 303 public static DT.ProblemParameterFloatValue ToDto(DA.ProblemParameterFloatValue source) { 304 if (source == null) return null; 305 return new DT.ProblemParameterFloatValue { ProblemParameterId = source.ProblemParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value }; 306 } 307 public static DA.ProblemParameterFloatValue ToEntity(DT.ProblemParameterFloatValue source) { 308 if (source == null) return null; 309 return new DA.ProblemParameterFloatValue { ProblemParameterId = source.ProblemParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value }; 310 } 311 public static void ToEntity(DT.ProblemParameterFloatValue source, DA.ProblemParameterFloatValue target) { 312 if ((source != null) && (target != null)) { 313 target.ProblemParameterId = source.ProblemParameterId; target.ExperimentId = source.ExperimentId; target.DataTypeId = source.DataTypeId; target.Value = source.Value; 314 } 315 } 316 #endregion 317 318 #region ProblemParameterIntValue 319 public static DT.ProblemParameterIntValue ToDto(DA.ProblemParameterIntValue source) { 320 if (source == null) return null; 321 return new DT.ProblemParameterIntValue { ProblemParameterId = source.ProblemParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value }; 322 } 323 public static DA.ProblemParameterIntValue ToEntity(DT.ProblemParameterIntValue source) { 324 if (source == null) return null; 325 return new DA.ProblemParameterIntValue { ProblemParameterId = source.ProblemParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value }; 326 } 327 public static void ToEntity(DT.ProblemParameterIntValue source, DA.ProblemParameterIntValue target) { 328 if ((source != null) && (target != null)) { 329 target.ProblemParameterId = source.ProblemParameterId; target.ExperimentId = source.ExperimentId; target.DataTypeId = source.DataTypeId; target.Value = source.Value; 330 } 331 } 332 #endregion 333 334 #region ProblemParameterStringValue 335 public static DT.ProblemParameterStringValue ToDto(DA.ProblemParameterStringValue source) { 336 if (source == null) return null; 337 return new DT.ProblemParameterStringValue { ProblemParameterId = source.ProblemParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value }; 338 } 339 public static DA.ProblemParameterStringValue ToEntity(DT.ProblemParameterStringValue source) { 340 if (source == null) return null; 341 return new DA.ProblemParameterStringValue { ProblemParameterId = source.ProblemParameterId, ExperimentId = source.ExperimentId, DataTypeId = source.DataTypeId, Value = source.Value }; 342 } 343 public static void ToEntity(DT.ProblemParameterStringValue source, DA.ProblemParameterStringValue target) { 344 if ((source != null) && (target != null)) { 345 target.ProblemParameterId = source.ProblemParameterId; target.ExperimentId = source.ExperimentId; target.DataTypeId = source.DataTypeId; target.Value = source.Value; 346 } 175 347 } 176 348 #endregion … … 186 358 } 187 359 public static void ToEntity(DT.Result source, DA.Result target) { 188 if ((source != null) && (target != null)) 360 if ((source != null) && (target != null)) { 189 361 target.Id = source.Id; target.Name = source.Name; target.Description = source.Description; target.Alias = source.Alias; target.AlgorithmId = source.AlgorithmId; target.DataTypeId = source.DataTypeId; 362 } 363 } 364 #endregion 365 366 #region ResultBlobValue 367 public static DT.ResultBlobValue ToDto(DA.ResultBlobValue source) { 368 if (source == null) return null; 369 return new DT.ResultBlobValue { ResultId = source.ResultId, RunId = source.RunId, DataTypeId = source.DataTypeId, Value = source.Value.ToArray() }; 370 } 371 public static DA.ResultBlobValue ToEntity(DT.ResultBlobValue source) { 372 if (source == null) return null; 373 return new DA.ResultBlobValue { ResultId = source.ResultId, RunId = source.RunId, DataTypeId = source.DataTypeId, Value = new Binary(source.Value) }; 374 } 375 public static void ToEntity(DT.ResultBlobValue source, DA.ResultBlobValue target) { 376 if ((source != null) && (target != null)) { 377 target.ResultId = source.ResultId; target.RunId = source.RunId; target.DataTypeId = source.DataTypeId; target.Value = new Binary(source.Value); 378 } 379 } 380 #endregion 381 382 #region ResultBoolValue 383 public static DT.ResultBoolValue ToDto(DA.ResultBoolValue source) { 384 if (source == null) return null; 385 return new DT.ResultBoolValue { ResultId = source.ResultId, RunId = source.RunId, DataTypeId = source.DataTypeId, Value = source.Value }; 386 } 387 public static DA.ResultBoolValue ToEntity(DT.ResultBoolValue source) { 388 if (source == null) return null; 389 return new DA.ResultBoolValue { ResultId = source.ResultId, RunId = source.RunId, DataTypeId = source.DataTypeId, Value = source.Value }; 390 } 391 public static void ToEntity(DT.ResultBoolValue source, DA.ResultBoolValue target) { 392 if ((source != null) && (target != null)) { 393 target.ResultId = source.ResultId; target.RunId = source.RunId; target.DataTypeId = source.DataTypeId; target.Value = source.Value; 394 } 395 } 396 #endregion 397 398 #region ResultFloatValue 399 public static DT.ResultFloatValue ToDto(DA.ResultFloatValue source) { 400 if (source == null) return null; 401 return new DT.ResultFloatValue { ResultId = source.ResultId, RunId = source.RunId, DataTypeId = source.DataTypeId, Value = source.Value }; 402 } 403 public static DA.ResultFloatValue ToEntity(DT.ResultFloatValue source) { 404 if (source == null) return null; 405 return new DA.ResultFloatValue { ResultId = source.ResultId, RunId = source.RunId, DataTypeId = source.DataTypeId, Value = source.Value }; 406 } 407 public static void ToEntity(DT.ResultFloatValue source, DA.ResultFloatValue target) { 408 if ((source != null) && (target != null)) { 409 target.ResultId = source.ResultId; target.RunId = source.RunId; target.DataTypeId = source.DataTypeId; target.Value = source.Value; 410 } 411 } 412 #endregion 413 414 #region ResultIntValue 415 public static DT.ResultIntValue ToDto(DA.ResultIntValue source) { 416 if (source == null) return null; 417 return new DT.ResultIntValue { ResultId = source.ResultId, RunId = source.RunId, DataTypeId = source.DataTypeId, Value = source.Value }; 418 } 419 public static DA.ResultIntValue ToEntity(DT.ResultIntValue source) { 420 if (source == null) return null; 421 return new DA.ResultIntValue { ResultId = source.ResultId, RunId = source.RunId, DataTypeId = source.DataTypeId, Value = source.Value }; 422 } 423 public static void ToEntity(DT.ResultIntValue source, DA.ResultIntValue target) { 424 if ((source != null) && (target != null)) { 425 target.ResultId = source.ResultId; target.RunId = source.RunId; target.DataTypeId = source.DataTypeId; target.Value = source.Value; 426 } 427 } 428 #endregion 429 430 #region ResultStringValue 431 public static DT.ResultStringValue ToDto(DA.ResultStringValue source) { 432 if (source == null) return null; 433 return new DT.ResultStringValue { ResultId = source.ResultId, RunId = source.RunId, DataTypeId = source.DataTypeId, Value = source.Value }; 434 } 435 public static DA.ResultStringValue ToEntity(DT.ResultStringValue source) { 436 if (source == null) return null; 437 return new DA.ResultStringValue { ResultId = source.ResultId, RunId = source.RunId, DataTypeId = source.DataTypeId, Value = source.Value }; 438 } 439 public static void ToEntity(DT.ResultStringValue source, DA.ResultStringValue target) { 440 if ((source != null) && (target != null)) { 441 target.ResultId = source.ResultId; target.RunId = source.RunId; target.DataTypeId = source.DataTypeId; target.Value = source.Value; 442 } 190 443 } 191 444 #endregion … … 194 447 public static DT.Experiment ToDto(DA.Experiment source) { 195 448 if (source == null) return null; 196 return new DT.Experiment { Id = source.Id, AlgorithmId = source.AlgorithmId, ProblemId = source.ProblemId }; 449 DT.Experiment target = new DT.Experiment { Id = source.Id, AlgorithmId = source.AlgorithmId, ProblemId = source.ProblemId }; 450 451 List<DT.AlgorithmParameterValue> algorithmParameterValues = new List<DT.AlgorithmParameterValue>(); 452 foreach (DA.AlgorithmParameterBlobValue value in source.AlgorithmParameterBlobValues) 453 algorithmParameterValues.Add(Convert.ToDto(value)); 454 foreach (DA.AlgorithmParameterBoolValue value in source.AlgorithmParameterBoolValues) 455 algorithmParameterValues.Add(Convert.ToDto(value)); 456 foreach (DA.AlgorithmParameterFloatValue value in source.AlgorithmParameterFloatValues) 457 algorithmParameterValues.Add(Convert.ToDto(value)); 458 foreach (DA.AlgorithmParameterIntValue value in source.AlgorithmParameterIntValues) 459 algorithmParameterValues.Add(Convert.ToDto(value)); 460 foreach (DA.AlgorithmParameterStringValue value in source.AlgorithmParameterStringValues) 461 algorithmParameterValues.Add(Convert.ToDto(value)); 462 target.AlgorithmParameterValues = algorithmParameterValues.ToArray(); 463 464 List<DT.ProblemParameterValue> problemParameterValues = new List<DT.ProblemParameterValue>(); 465 foreach (DA.ProblemParameterBlobValue value in source.ProblemParameterBlobValues) 466 problemParameterValues.Add(Convert.ToDto(value)); 467 foreach (DA.ProblemParameterBoolValue value in source.ProblemParameterBoolValues) 468 problemParameterValues.Add(Convert.ToDto(value)); 469 foreach (DA.ProblemParameterFloatValue value in source.ProblemParameterFloatValues) 470 problemParameterValues.Add(Convert.ToDto(value)); 471 foreach (DA.ProblemParameterIntValue value in source.ProblemParameterIntValues) 472 problemParameterValues.Add(Convert.ToDto(value)); 473 foreach (DA.ProblemParameterStringValue value in source.ProblemParameterStringValues) 474 problemParameterValues.Add(Convert.ToDto(value)); 475 target.ProblemParameterValues = problemParameterValues.ToArray(); 476 477 return target; 197 478 } 198 479 public static DA.Experiment ToEntity(DT.Experiment source) { 199 480 if (source == null) return null; 200 return new DA.Experiment { Id = source.Id, AlgorithmId = source.AlgorithmId, ProblemId = source.ProblemId }; 481 DA.Experiment target = new DA.Experiment(); 482 Convert.ToEntity(source, target); 483 return target; 201 484 } 202 485 public static void ToEntity(DT.Experiment source, DA.Experiment target) { 203 if ((source != null) && (target != null)) 486 if ((source != null) && (target != null)) { 204 487 target.Id = source.Id; target.AlgorithmId = source.AlgorithmId; target.ProblemId = source.ProblemId; 488 489 foreach (DT.AlgorithmParameterBlobValue value in source.AlgorithmParameterValues.OfType<DT.AlgorithmParameterBlobValue>()) 490 target.AlgorithmParameterBlobValues.Add(Convert.ToEntity(value)); 491 foreach (DT.AlgorithmParameterBoolValue value in source.AlgorithmParameterValues.OfType<DT.AlgorithmParameterBoolValue>()) 492 target.AlgorithmParameterBoolValues.Add(Convert.ToEntity(value)); 493 foreach (DT.AlgorithmParameterFloatValue value in source.AlgorithmParameterValues.OfType<DT.AlgorithmParameterFloatValue>()) 494 target.AlgorithmParameterFloatValues.Add(Convert.ToEntity(value)); 495 foreach (DT.AlgorithmParameterIntValue value in source.AlgorithmParameterValues.OfType<DT.AlgorithmParameterIntValue>()) 496 target.AlgorithmParameterIntValues.Add(Convert.ToEntity(value)); 497 foreach (DT.AlgorithmParameterStringValue value in source.AlgorithmParameterValues.OfType<DT.AlgorithmParameterStringValue>()) 498 target.AlgorithmParameterStringValues.Add(Convert.ToEntity(value)); 499 500 foreach (DT.ProblemParameterBlobValue value in source.ProblemParameterValues.OfType<DT.ProblemParameterBlobValue>()) 501 target.ProblemParameterBlobValues.Add(Convert.ToEntity(value)); 502 foreach (DT.ProblemParameterBoolValue value in source.ProblemParameterValues.OfType<DT.ProblemParameterBoolValue>()) 503 target.ProblemParameterBoolValues.Add(Convert.ToEntity(value)); 504 foreach (DT.ProblemParameterFloatValue value in source.ProblemParameterValues.OfType<DT.ProblemParameterFloatValue>()) 505 target.ProblemParameterFloatValues.Add(Convert.ToEntity(value)); 506 foreach (DT.ProblemParameterIntValue value in source.ProblemParameterValues.OfType<DT.ProblemParameterIntValue>()) 507 target.ProblemParameterIntValues.Add(Convert.ToEntity(value)); 508 foreach (DT.ProblemParameterStringValue value in source.ProblemParameterValues.OfType<DT.ProblemParameterStringValue>()) 509 target.ProblemParameterStringValues.Add(Convert.ToEntity(value)); 510 } 205 511 } 206 512 #endregion … … 209 515 public static DT.Run ToDto(DA.Run source) { 210 516 if (source == null) return null; 211 return new DT.Run { Id = source.Id, RandomSeed = source.RandomSeed, FinishedDate = source.FinishedDate, ExperimentId = source.ExperimentId, UserId = source.UserId, ClientId = source.ClientId }; 517 DT.Run target = new DT.Run { Id = source.Id, RandomSeed = source.RandomSeed, FinishedDate = source.FinishedDate, ExperimentId = source.ExperimentId, UserId = source.UserId, ClientId = source.ClientId }; 518 519 List<DT.ResultValue> resultValues = new List<DT.ResultValue>(); 520 foreach (DA.ResultBlobValue value in source.ResultBlobValues) 521 resultValues.Add(Convert.ToDto(value)); 522 foreach (DA.ResultBoolValue value in source.ResultBoolValues) 523 resultValues.Add(Convert.ToDto(value)); 524 foreach (DA.ResultFloatValue value in source.ResultFloatValues) 525 resultValues.Add(Convert.ToDto(value)); 526 foreach (DA.ResultIntValue value in source.ResultIntValues) 527 resultValues.Add(Convert.ToDto(value)); 528 foreach (DA.ResultStringValue value in source.ResultStringValues) 529 resultValues.Add(Convert.ToDto(value)); 530 target.ResultValues = resultValues.ToArray(); 531 532 return target; 212 533 } 213 534 public static DA.Run ToEntity(DT.Run source) { 214 535 if (source == null) return null; 215 return new DA.Run { Id = source.Id, RandomSeed = source.RandomSeed, FinishedDate = source.FinishedDate, ExperimentId = source.ExperimentId, UserId = source.UserId, ClientId = source.ClientId }; 536 DA.Run target = new DA.Run(); 537 Convert.ToEntity(source, target); 538 return target; 216 539 } 217 540 public static void ToEntity(DT.Run source, DA.Run target) { 218 if ((source != null) && (target != null)) 541 if ((source != null) && (target != null)) { 219 542 target.Id = source.Id; target.RandomSeed = source.RandomSeed; target.FinishedDate = source.FinishedDate; target.ExperimentId = source.ExperimentId; target.UserId = source.UserId; target.ClientId = source.ClientId; 220 543 544 foreach (DT.ResultBlobValue value in source.ResultValues.OfType<DT.ResultBlobValue>()) 545 target.ResultBlobValues.Add(Convert.ToEntity(value)); 546 foreach (DT.ResultBoolValue value in source.ResultValues.OfType<DT.ResultBoolValue>()) 547 target.ResultBoolValues.Add(Convert.ToEntity(value)); 548 foreach (DT.ResultFloatValue value in source.ResultValues.OfType<DT.ResultFloatValue>()) 549 target.ResultFloatValues.Add(Convert.ToEntity(value)); 550 foreach (DT.ResultIntValue value in source.ResultValues.OfType<DT.ResultIntValue>()) 551 target.ResultIntValues.Add(Convert.ToEntity(value)); 552 foreach (DT.ResultStringValue value in source.ResultValues.OfType<DT.ResultStringValue>()) 553 target.ResultStringValues.Add(Convert.ToEntity(value)); 554 } 221 555 } 222 556 #endregion -
branches/OKB/HeuristicLab.Services.OKB/3.3/HeuristicLab.Services.OKB-3.3.csproj
r4548 r4591 122 122 <Compile Include="Convert.cs" /> 123 123 <Compile Include="AuthenticationService.cs" /> 124 <Compile Include="ExperimentEqualityComparer.cs" /> 124 125 <Compile Include="Interfaces\IAuthenticationService.cs" /> 125 126 <Compile Include="Interfaces\IOKBService.cs" /> -
branches/OKB/HeuristicLab.Services.OKB/3.3/Interfaces/IOKBService.cs
r4566 r4591 170 170 void DeleteResult(long id); 171 171 #endregion 172 173 #region Experiment Methods 174 [OperationContract] 175 Experiment GetExperiment(long id); 176 [OperationContract] 177 IEnumerable<Experiment> GetExperiments(long algorithmId, long problemId); 178 [OperationContract] 179 long AddExperiment(Experiment dto); 180 [OperationContract] 181 void DeleteExperiment(long id); 182 #endregion 183 184 #region Run Methods 185 [OperationContract] 186 Run GetRun(long id); 187 [OperationContract] 188 IEnumerable<Run> GetRuns(long experimentId); 189 [OperationContract] 190 long AddRun(Run dto); 191 [OperationContract] 192 void DeleteRun(long id); 193 #endregion 172 194 } 173 195 } -
branches/OKB/HeuristicLab.Services.OKB/3.3/OKBService.cs
r4566 r4591 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Data.Linq; 24 25 using System.Linq; 25 26 using System.ServiceModel; … … 398 399 DataAccess.Result entity = okb.Results.FirstOrDefault(x => x.Id == id); 399 400 if (entity != null) okb.Results.DeleteOnSubmit(entity); 401 okb.SubmitChanges(); 402 } 403 } 404 #endregion 405 406 #region Experiment Methods 407 public DataTransfer.Experiment GetExperiment(long id) { 408 using (OKBDataContext okb = new OKBDataContext()) { 409 DataLoadOptions dlo = new DataLoadOptions(); 410 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterBlobValues); 411 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterBoolValues); 412 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterFloatValues); 413 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterIntValues); 414 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterStringValues); 415 dlo.LoadWith<Experiment>(x => x.ProblemParameterBlobValues); 416 dlo.LoadWith<Experiment>(x => x.ProblemParameterBoolValues); 417 dlo.LoadWith<Experiment>(x => x.ProblemParameterFloatValues); 418 dlo.LoadWith<Experiment>(x => x.ProblemParameterIntValues); 419 dlo.LoadWith<Experiment>(x => x.ProblemParameterStringValues); 420 okb.LoadOptions = dlo; 421 return Convert.ToDto(okb.Experiments.FirstOrDefault(x => x.Id == id)); 422 } 423 } 424 public IEnumerable<DataTransfer.Experiment> GetExperiments(long algorithmId, long problemId) { 425 using (OKBDataContext okb = new OKBDataContext()) { 426 DataLoadOptions dlo = new DataLoadOptions(); 427 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterBlobValues); 428 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterBoolValues); 429 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterFloatValues); 430 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterIntValues); 431 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterStringValues); 432 dlo.LoadWith<Experiment>(x => x.ProblemParameterBlobValues); 433 dlo.LoadWith<Experiment>(x => x.ProblemParameterBoolValues); 434 dlo.LoadWith<Experiment>(x => x.ProblemParameterFloatValues); 435 dlo.LoadWith<Experiment>(x => x.ProblemParameterIntValues); 436 dlo.LoadWith<Experiment>(x => x.ProblemParameterStringValues); 437 okb.LoadOptions = dlo; 438 if ((algorithmId != 0) && (problemId != 0)) 439 return okb.Experiments.Where(x => (x.AlgorithmId == algorithmId) && (x.ProblemId == problemId)).Select(x => Convert.ToDto(x)).ToArray(); 440 else if (algorithmId != 0) 441 return okb.Experiments.Where(x => x.AlgorithmId == algorithmId).Select(x => Convert.ToDto(x)).ToArray(); 442 else if (problemId != 0) 443 return okb.Experiments.Where(x => x.ProblemId == problemId).Select(x => Convert.ToDto(x)).ToArray(); 444 else 445 return okb.Experiments.Select(x => Convert.ToDto(x)).ToArray(); 446 } 447 } 448 public long AddExperiment(DataTransfer.Experiment dto) { 449 using (OKBDataContext okb = new OKBDataContext()) { 450 DataAccess.Experiment entity = Convert.ToEntity(dto); entity.Id = 0; 451 452 DataLoadOptions dlo = new DataLoadOptions(); 453 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterBlobValues); 454 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterBoolValues); 455 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterFloatValues); 456 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterIntValues); 457 dlo.LoadWith<Experiment>(x => x.AlgorithmParameterStringValues); 458 dlo.LoadWith<Experiment>(x => x.ProblemParameterBlobValues); 459 dlo.LoadWith<Experiment>(x => x.ProblemParameterBoolValues); 460 dlo.LoadWith<Experiment>(x => x.ProblemParameterFloatValues); 461 dlo.LoadWith<Experiment>(x => x.ProblemParameterIntValues); 462 dlo.LoadWith<Experiment>(x => x.ProblemParameterStringValues); 463 okb.LoadOptions = dlo; 464 465 var experiments = okb.Experiments.Where(x => ((x.AlgorithmId == entity.AlgorithmId) && (x.ProblemId == entity.ProblemId))); 466 ExperimentEqualityComparer comparer = new ExperimentEqualityComparer(); 467 Experiment exp = experiments.FirstOrDefault(x => comparer.Equals(x, entity)); 468 if (exp != null) { 469 return exp.Id; 470 } else { 471 okb.Experiments.InsertOnSubmit(entity); 472 okb.SubmitChanges(); 473 return entity.Id; 474 } 475 } 476 } 477 public void DeleteExperiment(long id) { 478 using (OKBDataContext okb = new OKBDataContext()) { 479 DataAccess.Experiment entity = okb.Experiments.FirstOrDefault(x => x.Id == id); 480 if (entity != null) okb.Experiments.DeleteOnSubmit(entity); 481 okb.SubmitChanges(); 482 } 483 } 484 #endregion 485 486 #region Run Methods 487 public DataTransfer.Run GetRun(long id) { 488 using (OKBDataContext okb = new OKBDataContext()) { 489 DataLoadOptions dlo = new DataLoadOptions(); 490 dlo.LoadWith<Run>(x => x.ResultBlobValues); 491 dlo.LoadWith<Run>(x => x.ResultBoolValues); 492 dlo.LoadWith<Run>(x => x.ResultFloatValues); 493 dlo.LoadWith<Run>(x => x.ResultIntValues); 494 dlo.LoadWith<Run>(x => x.ResultStringValues); 495 okb.LoadOptions = dlo; 496 return Convert.ToDto(okb.Runs.FirstOrDefault(x => x.Id == id)); 497 } 498 } 499 public IEnumerable<DataTransfer.Run> GetRuns(long experimentId) { 500 using (OKBDataContext okb = new OKBDataContext()) { 501 DataLoadOptions dlo = new DataLoadOptions(); 502 dlo.LoadWith<Run>(x => x.ResultBlobValues); 503 dlo.LoadWith<Run>(x => x.ResultBoolValues); 504 dlo.LoadWith<Run>(x => x.ResultFloatValues); 505 dlo.LoadWith<Run>(x => x.ResultIntValues); 506 dlo.LoadWith<Run>(x => x.ResultStringValues); 507 okb.LoadOptions = dlo; 508 return okb.Runs.Where(x => x.ExperimentId == experimentId).Select(x => Convert.ToDto(x)).ToArray(); 509 } 510 } 511 public long AddRun(DataTransfer.Run dto) { 512 using (OKBDataContext okb = new OKBDataContext()) { 513 DataAccess.Run entity = Convert.ToEntity(dto); entity.Id = 0; 514 okb.Runs.InsertOnSubmit(entity); 515 okb.SubmitChanges(); 516 return entity.Id; 517 } 518 } 519 public void DeleteRun(long id) { 520 using (OKBDataContext okb = new OKBDataContext()) { 521 DataAccess.Run entity = okb.Runs.FirstOrDefault(x => x.Id == id); 522 if (entity != null) okb.Runs.DeleteOnSubmit(entity); 400 523 okb.SubmitChanges(); 401 524 }
Note: See TracChangeset
for help on using the changeset viewer.