public ScoreCollectionInfo(ObjectiveScoreCollection scores, TagCollection tagCollection) { line = new Dictionary <string, string>(); HyperCube hyperCubeScores = (scores.SysConfiguration) as HyperCube; if (hyperCubeScores != null) { foreach (var variable in hyperCubeScores.Variables) { line.Add(variable.Name, variable.Value.ToString()); } } foreach (var score in scores.Scores) { line.Add(score.Name, score.Value); } foreach (var tag in tagCollection.Tags) { line.Add(tag.Name, tag.Value); } }
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(); } }