Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5459


Ignore:
Timestamp:
02/15/11 03:16:35 (14 years ago)
Author:
swagner
Message:

Worked on OKB (#1174)

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  
    1515      </nestedChildShapes>
    1616    </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">
    1818      <DataClassMoniker Name="/OKBDataContext/AlgorithmUser" />
    1919      <nestedChildShapes>
     
    2121      </nestedChildShapes>
    2222    </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">
    2424      <DataClassMoniker Name="/OKBDataContext/ProblemUser" />
    2525      <nestedChildShapes>
     
    3939      </nestedChildShapes>
    4040    </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">
    4242      <AssociationMoniker Name="/OKBDataContext/Platform/Platform_DataType" />
    4343      <nodes>
     
    5858      </nestedChildShapes>
    5959    </classShape>
    60     <associationConnector edgePoints="[(2.75 : 2.35); (2.5 : 2.35)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     60    <associationConnector edgePoints="[(2.75 : 2.39024983723958); (2.5 : 2.39024983723958)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    6161      <AssociationMoniker Name="/OKBDataContext/Algorithm/Algorithm_AlgorithmUser" />
    6262      <nodes>
     
    6565      </nodes>
    6666    </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">
    6868      <AssociationMoniker Name="/OKBDataContext/AlgorithmClass/AlgorithmClass_Algorithm" />
    6969      <nodes>
     
    7272      </nodes>
    7373    </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">
    7575      <AssociationMoniker Name="/OKBDataContext/DataType/DataType_Algorithm" />
    7676      <nodes>
     
    7979      </nodes>
    8080    </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">
    8282      <AssociationMoniker Name="/OKBDataContext/Platform/Platform_Algorithm" />
    8383      <nodes>
     
    9292      </nestedChildShapes>
    9393    </classShape>
    94     <associationConnector edgePoints="[(13.25 : 2.35); (13.5 : 2.35)]" fixedFrom="Algorithm" fixedTo="Algorithm">
     94    <associationConnector edgePoints="[(13.25 : 2.39024983723958); (13.5 : 2.39024983723958)]" fixedFrom="Algorithm" fixedTo="Algorithm">
    9595      <AssociationMoniker Name="/OKBDataContext/Problem/Problem_ProblemUser" />
    9696      <nodes>
     
    9999      </nodes>
    100100    </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">
    102102      <AssociationMoniker Name="/OKBDataContext/DataType/DataType_Problem" />
    103103      <nodes>
     
    106106      </nodes>
    107107    </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">
    109109      <AssociationMoniker Name="/OKBDataContext/Platform/Platform_Problem" />
    110110      <nodes>
     
    113113      </nodes>
    114114    </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">
    116116      <AssociationMoniker Name="/OKBDataContext/ProblemClass/ProblemClass_Problem" />
    117117      <nodes>
     
    126126      </nestedChildShapes>
    127127    </classShape>
    128     <associationConnector edgePoints="[(7 : 10.3182703039497); (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">
    129129      <AssociationMoniker Name="/OKBDataContext/BinaryData/BinaryData_Algorithm" />
    130130      <nodes>
     
    133133      </nodes>
    134134    </associationConnector>
    135     <associationConnector edgePoints="[(9 : 10.3181469726562); (12.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">
    136136      <AssociationMoniker Name="/OKBDataContext/BinaryData/BinaryData_Problem" />
    137137      <nodes>
     
    146146      </nestedChildShapes>
    147147    </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">
    149149      <AssociationMoniker Name="/OKBDataContext/Algorithm/Algorithm_Run" />
    150150      <nodes>
     
    153153      </nodes>
    154154    </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">
    156156      <AssociationMoniker Name="/OKBDataContext/Problem/Problem_Run" />
    157157      <nodes>
     
    166166      </nestedChildShapes>
    167167    </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">
    169169      <AssociationMoniker Name="/OKBDataContext/BinaryData/BinaryData_Value" />
    170170      <nodes>
     
    173173      </nodes>
    174174    </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">
    176176      <AssociationMoniker Name="/OKBDataContext/DataType/DataType_Value" />
    177177      <nodes>
     
    180180      </nodes>
    181181    </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">
    183183      <AssociationMoniker Name="/OKBDataContext/Run/Run_Value" />
    184184      <nodes>
     
    187187      </nodes>
    188188    </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">
    190190      <AssociationMoniker Name="/OKBDataContext/ValueName/ValueName_Value" />
    191191      <nodes>
     
    206206      </nestedChildShapes>
    207207    </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">
    209209      <AssociationMoniker Name="/OKBDataContext/Characteristic/Characteristic_CharacteristicValue" />
    210210      <nodes>
     
    213213      </nodes>
    214214    </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">
    216216      <AssociationMoniker Name="/OKBDataContext/DataType/DataType_CharacteristicValue" />
    217217      <nodes>
     
    220220      </nodes>
    221221    </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">
    223223      <AssociationMoniker Name="/OKBDataContext/Problem/Problem_CharacteristicValue" />
    224224      <nodes>
  • branches/OKB (trunk integration)/HeuristicLab.Services.OKB.DataTransfer/3.3/Value.cs

    r5378 r5459  
    3535    public string Name { get; set; }
    3636    [DataMember]
    37     public long RunId { get; set; }
    38     [DataMember]
    3937    public long DataTypeId { get; set; }
    4038  }
  • branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/AdministrationService.cs

    r5389 r5459  
    7575      }
    7676    }
    77     public IEnumerable<DataTransfer.DataType> GetDataTypes() {
    78       using (OKBDataContext okb = new OKBDataContext()) {
    79         return okb.DataTypes.Select(x => Convert.ToDto(x)).ToArray();
    80       }
    81     }
    8277    public long AddDataType(DataTransfer.DataType dto) {
    8378      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;
    10286      }
    10387    }
     
    130114      }
    131115    }
    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     }
    139116    #endregion
    140117
     
    319296    #endregion
    320297
    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) {
    393300      using (OKBDataContext okb = new OKBDataContext()) {
    394301        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);
    405304        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) {
    410309      using (OKBDataContext okb = new OKBDataContext()) {
    411310        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);
    422313        okb.LoadOptions = dlo;
    423314        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();
    425316        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();
    427318        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();
    429320        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();
    519322      }
    520323    }
  • branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Convert.cs

    r5389 r5459  
    5353      return new DA.DataType { Id = source.Id, Name = source.Name, TypeName = source.TypeName, PlatformId = source.PlatformId };
    5454    }
    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     }
    6055    #endregion
    6156
  • branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Interfaces/IAdministrationService.cs

    r5389 r5459  
    4949    DataType GetDataType(long id);
    5050    [OperationContract]
    51     IEnumerable<DataType> GetDataTypes();
    52     [OperationContract]
    5351    long AddDataType(DataType dto);
    54     [OperationContract]
    55     void UpdateDataType(DataType dto);
    56     [OperationContract]
    57     void DeleteDataType(long id);
    5852    #endregion
    5953
     
    6357    [OperationContract]
    6458    long AddBinaryData(BinaryData dto);
    65     [OperationContract]
    66     void DeleteBinaryData(long id);
    6759    #endregion
    6860
Note: See TracChangeset for help on using the changeset viewer.