- Timestamp:
- 09/18/09 22:20:34 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Modeling.Database.SQLServerCompact/3.2/DatabaseService.cs
r2355 r2370 60 60 dlo.LoadWith<InputVariableResult>(ir => ir.Result); 61 61 dlo.LoadWith<Model>(m => m.TargetVariable); 62 dlo.LoadWith<Model>(m => m.Algorithm); 62 dlo.LoadWith<Model>(m => m.Algorithm); 63 63 ctx.LoadOptions = dlo; 64 64 } … … 110 110 111 111 using (ModelingDataContext ctx = new ModelingDataContext(connection)) { 112 foreach (KeyValuePair< string, double> pair in model.Results) {113 Result result = GetOrCreateResult(pair.Key );112 foreach (KeyValuePair<ModelingResult, double> pair in model.Results) { 113 Result result = GetOrCreateResult(pair.Key.ToString()); 114 114 ctx.ModelResults.InsertOnSubmit(new ModelResult(m, result, pair.Value)); 115 115 } … … 127 127 128 128 using (ModelingDataContext ctx = new ModelingDataContext(connection)) { 129 IEnumerable<MethodInfo> inputVariableResultInfos = model.GetType().GetMethods().Where( 130 info => info.GetParameters().Count() == 1 && 131 info.GetParameters()[0].ParameterType == typeof(string) && 132 info.GetParameters()[0].Name == "variableName" && 133 info.ReturnParameter.ParameterType == typeof(double) && 134 info.Name.StartsWith("Get")); 135 foreach (MethodInfo inputVariableResultInfo in inputVariableResultInfos) { 136 Result result = GetOrCreateResult(inputVariableResultInfo.Name.Substring(3)); 137 foreach (InputVariable variable in ctx.InputVariables.Where(iv => iv.Model == m)) { 138 double value = (double)inputVariableResultInfo.Invoke(model, new object[] { variable.Variable.Name }); 139 ctx.InputVariableResults.InsertOnSubmit(new InputVariableResult(variable, result, value)); 129 foreach (InputVariable variable in ctx.InputVariables.Where(iv => iv.Model == m)) { 130 foreach (KeyValuePair<ModelingResult, double> variableResult in model.GetVariableResults(variable.Variable.Name)) { 131 Result result = GetOrCreateResult(variableResult.Key.ToString()); 132 ctx.InputVariableResults.InsertOnSubmit(new InputVariableResult(variable, result, variableResult.Value)); 140 133 } 141 134 } … … 286 279 using (ModelingDataContext ctx = new ModelingDataContext(connection)) { 287 280 var md = from r in ctx.MetaData 288 289 281 where r.Name == name 282 select r; 290 283 if (md.Count() == 0) { 291 284 metadata = new MetaData(name);
Note: See TracChangeset
for help on using the changeset viewer.