private bool OleDbSetParameterOrder(Expression node, object[] args) { if (node.NodeType == NodeType.Filter) { // the parameters in this filter are the next in sequence Filter filter = (Filter)node; Expression.EnumNodesCallBack callback = new Expression.EnumNodesCallBack(this.OleDbSetParameterOrderInFilter); Expression.EnumNodes(filter.Source, callback, null, args); Expression.EnumNodes(filter.Constraint, callback, null, args); } return(true); }
private bool LinkPropertiesToMap(Expression node, object[] args) { if (node.NodeType == NodeType.Filter) { Filter filter = (Filter)node; Expression.EnumNodesCallBack callback = new Expression.EnumNodesCallBack(this.LinkPropertiesToMap); if (args.Length > 0) { Expression.EnumNodes(filter.Source, callback, null, args); } // add the new filter to the font of the list object[] newArgs = new object[args.Length + 1]; Array.Copy(args, 0, newArgs, 1, args.Length); newArgs[0] = filter; Expression.EnumNodes(filter.Constraint, callback, null, newArgs); return(false); } else if (node.NodeType == NodeType.Property) { Property property = (Property)node; // determine the level of the filter to link int level = 0; if (property.Source.NodeType == NodeType.Parent) { level = (property.Source as Parent).Level; // replace the parent source with a new context for linking property.Source = new Context(); } if (level >= args.Length) { throw new OPathException("Property '" + property.Name + "' could not be associated to an entity."); } // set the context link to the source of the filter Context context = (Context)property.Source; context.Link = (args[level] as Filter).Source; // set the property info SetPropertyInfo(property); } return(true); }
private void SetParameterOrder(ObjectExpression oe) { if (oe.ParameterCount == 0) { return; } if (_provider.Provider == Provider.Access || _provider.Provider == Provider.OleDb) { // the OleDb driver expects the order of parameters to be specified in "subquery major" order (which I consider a *major* design flaw). // in other words, the order is driven by a post traversal of the select statements (filters), with standard left-to-right order within a given select. Expression.EnumNodesCallBack postCallback = new Expression.EnumNodesCallBack(this.OleDbSetParameterOrder); Expression.EnumNodes(oe.Expression, null, postCallback, 0); } else // not an OleDb provider { // use standard right-to-left order (which the parameters are already in) for (int i = _parameterTable.Count - 1; i >= 0; i--) { _parameterTable[i].Ordinal = i; } } }
private bool LinkPropertiesToMap(Expression node, object[] args) { if( node.NodeType == NodeType.Filter ) { Filter filter = (Filter)node; Expression.EnumNodesCallBack callback = new Expression.EnumNodesCallBack(this.LinkPropertiesToMap); if( args.Length > 0 ) { Expression.EnumNodes(filter.Source, callback, null, args); } // add the new filter to the font of the list object[] newArgs = new object[args.Length + 1]; Array.Copy(args, 0, newArgs, 1, args.Length); newArgs[0] = filter; Expression.EnumNodes(filter.Constraint, callback, null, newArgs); return false; } else if( node.NodeType == NodeType.Property ) { Property property = (Property)node; // determine the level of the filter to link int level = 0; if( property.Source.NodeType == NodeType.Parent ) { level = (property.Source as Parent).Level; // replace the parent source with a new context for linking property.Source = new Context(); } if( level >= args.Length ) { throw new OPathException("Property '" + property.Name + "' could not be associated to an entity."); } // set the context link to the source of the filter Context context = (Context)property.Source; context.Link = (args[level] as Filter).Source; // set the property info SetPropertyInfo(property); } return true; }
private void SetParameterOrder(ObjectExpression oe) { if( oe.ParameterCount == 0 ) return; if( _provider.Provider == Provider.Access || _provider.Provider == Provider.OleDb ) { // the OleDb driver expects the order of parameters to be specified in "subquery major" order (which I consider a *major* design flaw). // in other words, the order is driven by a post traversal of the select statements (filters), with standard left-to-right order within a given select. Expression.EnumNodesCallBack postCallback = new Expression.EnumNodesCallBack(this.OleDbSetParameterOrder); Expression.EnumNodes(oe.Expression, null, postCallback, 0); } else // not an OleDb provider { // use standard right-to-left order (which the parameters are already in) for( int i = _parameterTable.Count - 1; i >= 0; i-- ) { _parameterTable[i].Ordinal = i; } } }
private bool OleDbSetParameterOrder(Expression node, object[] args) { if( node.NodeType == NodeType.Filter ) { // the parameters in this filter are the next in sequence Filter filter = (Filter)node; Expression.EnumNodesCallBack callback = new Expression.EnumNodesCallBack(this.OleDbSetParameterOrderInFilter); Expression.EnumNodes(filter.Source, callback, null, args); Expression.EnumNodes(filter.Constraint, callback, null, args); } return true; }