public void RebuildUI() { INodes.Clear(); IPath.Clear(); SetView.Nodes[0].Nodes.Clear(); foreach (var s in InImages) { SetView.Nodes[0].Nodes.Add(s.Name + "[" + s.Imgs.Count + "]"); foreach (var i in s.Imgs) { var nn = SetView.Nodes[0].Nodes[SetView.Nodes[0].Nodes.Count - 1].Nodes.Add("F:" + i.Name); INodes.Add(nn); IPath.Add(nn, i); } } SetView.Nodes[1].Nodes.Clear(); foreach (var s in OutImages) { SetView.Nodes[1].Nodes.Add(s.Name + "[" + s.Imgs.Count + "]"); foreach (var i in s.Imgs) { var nn = SetView.Nodes[1].Nodes[SetView.Nodes[1].Nodes.Count - 1].Nodes.Add("F:" + i.Name); ONodes.Add(nn); OPath.Add(nn, i); } } }
/// <summary> /// Compiles this OPathQuery using the mappings found in the specified ObjectSpace instance. /// </summary> /// <param name="os">ObjectSpace instance to use.</param> /// <returns>A CompiledQuery that is the result of this instance being compiled.</returns> public new CompiledQuery <T> Compile(ObjectSpace os) { ObjectExpression oe = OPath.Parse(this, os.context.Mappings); return(new CompiledQuery <T>(oe)); }
public override object LoadScalar(OPath.OPathQuery query) { if (query.QueryType == OPathQueryTypeEnum.Path) { query.QueryType = OPathQueryTypeEnum.Expression; query.Expression = new OPath.Expressions.Call("eval", new Evaluant.OPath.Expressions.Collections.ConstraintCollection(new OPath.Expressions.Constraint[] { query.Path })); } SqlMapperTransformer transformer = new SqlMapperTransformer(_Mapping, _Model); transformer.Dialect = Dialect; ISQLExpression exp = transformer.TransformScalar(query); _Connection.Open(); _Transaction = _Connection.BeginTransaction(); object result = null; try { string[] queries = Dialect.RenderQueries(exp); IDbCommand command = Driver.CreateCommand(queries[queries.Length - 1], _Connection, _Transaction); if (TraceSqlSwitch.Enabled) { TraceHelpler.Trace(command, _Dialect); } object res = command.ExecuteScalar(); if (res != DBNull.Value) result = res; _Transaction.Commit(); } catch { _Transaction.Rollback(); throw; } finally { _Connection.Close(); } // Ensure the result in an Int32 in case of a count() if (query.Expression.Operands[0] is OPath.Expressions.Function && ((OPath.Expressions.Function)query.Expression.Operands[0]).Type == Evaluant.OPath.Expressions.FunctionEnum.Count) result = Convert.ToInt32(result); return result; }