public ObjResultsInfo(ObjectivesResultsCollection result) { this.result = result; foreach (var scores in result.ScoresSet) { entries.Add(new ScoreCollectionInfo(scores, result.Tags)); } }
public void TestWrite() { // TODO: make this machine independent. Needs an SQL server for tests if (Environment.MachineName.ToLower() != "chrome-bu") { return; } using (var db = new OptimizationResultsContext()) { var resultsSet = new ObjectivesResultsCollection { Name = "Result Set" }; var aPointWithScores = new ObjectiveScoreCollection(); aPointWithScores.Scores = new List <ObjectiveScore> { new ObjectiveScore { Name = "NSE", Value = "0.5", Maximize = true }, new ObjectiveScore { Name = "Bias", Value = "0.6", Maximize = false } }; var hc = new HyperCube { Name = "HyperCube Name" }; hc.Variables = new List <VariableSpecification> { new VariableSpecification { Maximum = 1, Minimum = 0, Name = "aParameter_1", Value = 0.5f }, new VariableSpecification { Maximum = 1, Minimum = 0, Name = "aParameter_2", Value = 0.5f } }; aPointWithScores.SysConfiguration = hc; resultsSet.ScoresSet = new List <ObjectiveScoreCollection> { aPointWithScores }; var attributes = new TagCollection(); attributes.Tags = new List <Tag> { new Tag { Name = "ModelId", Value = "GR4J" }, new Tag { Name = "CatchmentId", Value = "123456" } }; resultsSet.Tags = attributes; db.ObjectivesResultsCollectionSet.Add(resultsSet); int recordsAffected = db.SaveChanges(); //Console.WriteLine( // "Saved {0} entities to the database, press any key to exit.", // recordsAffected); //Console.ReadKey(); } }