Esempio n. 1
0
 /// <summary>
 /// Constructor for binderbase.
 /// </summary>
 /// <param name="bindMethod">Method to use for binding the parent token, if needed.</param>
 /// <param name="state">State of the metadata binding.</param>
 protected BinderBase(MetadataBinder.QueryTokenVisitor bindMethod, BindingState state)
 {
     ExceptionUtils.CheckArgumentNotNull(bindMethod, "bindMethod");
     ExceptionUtils.CheckArgumentNotNull(state, "state");
     this.bindMethod = bindMethod;
     this.state = state;
 }
Esempio n. 2
0
 /// <summary>
 /// Constructor for binderbase.
 /// </summary>
 /// <param name="bindMethod">Method to use for binding the parent token, if needed.</param>
 /// <param name="state">State of the metadata binding.</param>
 protected BinderBase(MetadataBinder.QueryTokenVisitor bindMethod, BindingState state)
 {
     ExceptionUtils.CheckArgumentNotNull(bindMethod, "bindMethod");
     ExceptionUtils.CheckArgumentNotNull(state, "state");
     this.bindMethod = bindMethod;
     this.state      = state;
 }
Esempio n. 3
0
 public ApplyBinder(MetadataBinder.QueryTokenVisitor bindMethod, BindingState state)
 {
     this.bindMethod    = bindMethod;
     this.state         = state;
     this.filterBinder  = new FilterBinder(bindMethod, state);
     this.computeBinder = new ComputeBinder(bindMethod);
 }
Esempio n. 4
0
            /// <summary>
            /// Constructs a BindInfo with the given <paramref name="bindMethod"/>.
            /// </summary>
            /// <param name="bindingStateQueryOptions">The query options to be passed for the binding state. Null by default.</param>
            /// <param name="bindMethodDelegate">The bind method algorithm. By default, uses MetadataBinder method
            /// if this parameter isn't populated.</param>
            public BindInfo(List <CustomQueryOptionToken> bindingStateQueryOptions = null, MetadataBinder.QueryTokenVisitor bindMethod = null)
            {
                ResourceRangeVariable implicitRangeVariable = new ResourceRangeVariable(
                    ExpressionConstants.It,
                    HardCodedTestModel.GetPersonTypeReference(),
                    HardCodedTestModel.GetPeopleSet());

                this.bindingState = new BindingState(configuration)
                {
                    ImplicitRangeVariable = implicitRangeVariable
                };
                this.bindingState.RangeVariables.Push(
                    new BindingState(configuration)
                {
                    ImplicitRangeVariable = implicitRangeVariable
                }.ImplicitRangeVariable);

                if (bindingStateQueryOptions != null)
                {
                    this.bindingState.QueryOptions = bindingStateQueryOptions;
                }

                this.binder     = new MetadataBinder(bindingState);
                this.bindMethod = bindMethod ?? binder.Bind;
            }
Esempio n. 5
0
        /// <summary>
        /// Create a new ODataUriSemanticBinder to bind an entire uri to Metadata.
        /// </summary>
        /// <param name="bindingState">the current state of the binding algorithm</param>
        /// <param name="bindMethod">pointer to the metadata bind method.</param>
        public ODataUriSemanticBinder(BindingState bindingState, MetadataBinder.QueryTokenVisitor bindMethod)
        {
            ExceptionUtils.CheckArgumentNotNull(bindingState, "bindingState");
            ExceptionUtils.CheckArgumentNotNull(bindMethod, "bindMethod");

            this.bindingState = bindingState;
            this.bindMethod   = bindMethod;
        }
Esempio n. 6
0
 public ApplyBinder(MetadataBinder.QueryTokenVisitor bindMethod, BindingState state, ODataUriParserConfiguration configuration, ODataPathInfo odataPathInfo)
 {
     this.bindMethod    = bindMethod;
     this.state         = state;
     this.filterBinder  = new FilterBinder(bindMethod, state);
     this.configuration = configuration;
     this.odataPathInfo = odataPathInfo;
 }
Esempio n. 7
0
 /// <summary>
 /// Constructs a LambdaBinder.
 /// </summary>
 /// <param name="bindMethod">Method used to bind a parent token.</param>
 internal LambdaBinder(MetadataBinder.QueryTokenVisitor bindMethod)
 {
     ExceptionUtils.CheckArgumentNotNull(bindMethod, "bindMethod");
     this.bindMethod = bindMethod;
 }
Esempio n. 8
0
        /// <summary>
        /// Process the remaining query options (represent the set of custom query options after
        /// service operation parameters and system query options have been removed).
        /// </summary>
        /// <param name="bindingState">the current state of the binding algorithm.</param>
        /// <param name="bindMethod">pointer to a binder method.</param>
        /// <returns>The list of <see cref="QueryNode"/> instances after binding.</returns>
        /// <exception cref="ODataException">Throws if bindingState is null.</exception>
        /// <exception cref="ODataException">Throws if bindMethod is null.</exception>
        public static List <QueryNode> ProcessQueryOptions(BindingState bindingState, MetadataBinder.QueryTokenVisitor bindMethod)
        {
            if (bindingState == null || bindingState.QueryOptions == null)
            {
                throw new ODataException(ODataErrorStrings.MetadataBinder_QueryOptionsBindStateCannotBeNull);
            }

            if (bindMethod == null)
            {
                throw new ODataException(ODataErrorStrings.MetadataBinder_QueryOptionsBindMethodCannotBeNull);
            }

            List <QueryNode> customQueryOptionNodes = new List <QueryNode>();

            foreach (CustomQueryOptionToken queryToken in bindingState.QueryOptions)
            {
                QueryNode customQueryOptionNode = bindMethod(queryToken);
                if (customQueryOptionNode != null)
                {
                    customQueryOptionNodes.Add(customQueryOptionNode);
                }
            }

            bindingState.QueryOptions = null;
            return(customQueryOptionNodes);
        }
Esempio n. 9
0
 /// <summary>
 /// Constructs a DottedIdentifierBinder with the given method to be used binding the parent token if needed.
 /// </summary>
 /// <param name="bindMethod">Method to use for binding the parent token, if needed.</param>
 internal DottedIdentifierBinder(MetadataBinder.QueryTokenVisitor bindMethod)
 {
     DebugUtils.CheckNoExternalCallers();
     ExceptionUtils.CheckArgumentNotNull(bindMethod, "bindMethod");
     this.bindMethod = bindMethod;
 }
Esempio n. 10
0
 /// <summary>
 /// Constructs a CountSegmentBinder object.
 /// </summary>
 /// <param name="bindMethod">Method to use to visit the token tree and bind the tokens recursively.</param>
 /// <param name="state">State of the metadata binding.</param>
 internal CountSegmentBinder(MetadataBinder.QueryTokenVisitor bindMethod, BindingState state)
 {
     this.bindMethod = bindMethod;
     this.state      = state;
 }
Esempio n. 11
0
 /// <summary>
 /// Constructs a FunctionCallBinder with the given method to be used binding the parent token if needed.
 /// </summary>
 /// <param name="bindMethod">Method to use for binding the parent token, if needed.</param>
 internal FunctionCallBinder(MetadataBinder.QueryTokenVisitor bindMethod)
 {
     this.bindMethod = bindMethod;
 }
 /// <summary>
 /// Creates an OrderByBinder
 /// </summary>
 /// <param name="bindMethod">Method to use to visit the token tree and bind the tokens recursively.</param>
 internal ParameterAliasBinder(MetadataBinder.QueryTokenVisitor bindMethod)
 {
     ExceptionUtils.CheckArgumentNotNull(bindMethod, "bindMethod");
     this.bindMethod = bindMethod;
 }
Esempio n. 13
0
 /// <summary>
 /// Constructs a EndPathBinder object using the given function to bind parent token.
 /// </summary>
 /// <param name="bindMethod">Method to bind the EndPathToken's parent, if there is one.</param>
 /// <param name="state">State of the metadata binding.</param>am>
 /// <remarks>
 /// Make bindMethod of return type SingleValueQueryNode.
 /// </remarks>
 internal EndPathBinder(MetadataBinder.QueryTokenVisitor bindMethod, BindingState state)
     : base(bindMethod, state)
 {
     this.functionCallBinder = new FunctionCallBinder(bindMethod, state);
 }
Esempio n. 14
0
 /// <summary>
 /// Constructs a EndPathBinder object using the given function to bind parent token.
 /// </summary>
 /// <param name="bindMethod">Method to bind the EndPathToken's parent, if there is one.</param>
 internal EndPathBinder(MetadataBinder.QueryTokenVisitor bindMethod)
 {
     this.bind = bindMethod;
     this.functionCallBinder = new FunctionCallBinder(bindMethod);
 }
Esempio n. 15
0
 /// <summary>
 /// Creates a FilterBinder.
 /// </summary>
 /// <param name="bindMethod">Method to use to visit the token tree and bind the tokens recursively.</param>
 /// <param name="state">State to use for binding.</param>
 internal FilterBinder(MetadataBinder.QueryTokenVisitor bindMethod, BindingState state)
 {
     this.bindMethod = bindMethod;
     this.state = state;
 }
Esempio n. 16
0
 /// <summary>
 /// Constructs a KeyBinder object using the given function to bind key values.
 /// </summary>
 /// <param name="keyValueBindMethod">Method to call to bind a value in a key.</param>
 internal KeyBinder(MetadataBinder.QueryTokenVisitor keyValueBindMethod)
 {
     this.keyValueBindMethod = keyValueBindMethod;
 }
Esempio n. 17
0
 /// <summary>
 /// Constructs a KeyBinder object using the given function to bind key values.
 /// </summary>
 /// <param name="keyValueBindMethod">Method to call to bind a value in a key.</param>
 internal KeyBinder(MetadataBinder.QueryTokenVisitor keyValueBindMethod)
 {
     this.keyValueBindMethod = keyValueBindMethod;
 }
Esempio n. 18
0
 public ComputeBinder(MetadataBinder.QueryTokenVisitor bindMethod)
 {
     this.bindMethod = bindMethod;
 }
Esempio n. 19
0
 /// <summary>
 /// Constructs a KeyBinder object using the given function to bind key values.
 /// </summary>
 /// <param name="keyValueBindMethod">Method to call to bind a value in a key.</param>
 internal KeyBinder(MetadataBinder.QueryTokenVisitor keyValueBindMethod)
 {
     DebugUtils.CheckNoExternalCallers();
     this.keyValueBindMethod = keyValueBindMethod;
 }
Esempio n. 20
0
 /// <summary>
 /// Constructs a InnerPathTokenBinder.
 /// </summary>
 /// <param name="bindMethod">Bind method to use for binding a parent node, if needed.</param>
 internal InnerPathTokenBinder(MetadataBinder.QueryTokenVisitor bindMethod)
 {
     DebugUtils.CheckNoExternalCallers();
     this.bindMethod = bindMethod;
 }
Esempio n. 21
0
        /// <summary>
        /// Process the remaining query options (represent the set of custom query options after
        /// service operation parameters and system query options have been removed).
        /// </summary>
        /// <param name="bindingState">the current state of the binding algorithm.</param>
        /// <param name="bindMethod">pointer to a binder method.</param>
        /// <returns>The list of <see cref="QueryNode"/> instances after binding.</returns>
        public static List <QueryNode> ProcessQueryOptions(BindingState bindingState, MetadataBinder.QueryTokenVisitor bindMethod)
        {
            List <QueryNode> customQueryOptionNodes = new List <QueryNode>();

            foreach (CustomQueryOptionToken queryToken in bindingState.QueryOptions)
            {
                QueryNode customQueryOptionNode = bindMethod(queryToken);
                if (customQueryOptionNode != null)
                {
                    customQueryOptionNodes.Add(customQueryOptionNode);
                }
            }

            bindingState.QueryOptions = null;
            return(customQueryOptionNodes);
        }
Esempio n. 22
0
 /// <summary>
 /// Creates a FilterBinder.
 /// </summary>
 /// <param name="bindMethod">Method to use to visit the token tree and bind the tokens recursively.</param>
 /// <param name="state">State to use for binding.</param>
 internal FilterBinder(MetadataBinder.QueryTokenVisitor bindMethod, BindingState state)
 {
     this.bindMethod = bindMethod;
     this.state      = state;
 }
Esempio n. 23
0
 /// <summary>
 /// Constructs a EndPathBinder object using the given function to bind parent token.
 /// </summary>
 /// <param name="bindMethod">Method to bind the EndPathToken's parent, if there is one.</param>
 internal EndPathBinder(MetadataBinder.QueryTokenVisitor bindMethod)
 {
     DebugUtils.CheckNoExternalCallers();
     this.bind = bindMethod;
     this.functionCallBinder = new FunctionCallBinder(bindMethod);
 }
Esempio n. 24
0
 /// <summary>
 /// Constructs a InnerPathTokenBinder.
 /// </summary>
 /// <param name="bindMethod">Bind method to use for binding a parent node, if needed.</param>
 /// <param name="state">State of the metadata binding.</param>
 internal InnerPathTokenBinder(MetadataBinder.QueryTokenVisitor bindMethod, BindingState state)
     : base(bindMethod, state)
 {
 }
Esempio n. 25
0
 /// <summary>
 /// Constructs a FunctionCallBinder with the given method to be used binding the parent token if needed.
 /// </summary>
 /// <param name="bindMethod">Method to use for binding the parent token, if needed.</param>
 internal FunctionCallBinder(MetadataBinder.QueryTokenVisitor bindMethod)
 {
     DebugUtils.CheckNoExternalCallers();
     this.bindMethod = bindMethod;
 }
Esempio n. 26
0
 /// <summary>
 /// Constructs a EnumBinder with the given method to be used binding the parent token if needed.
 /// </summary>
 /// <param name="bindMethod">Method to use for binding the parent token, if needed.</param>
 internal EnumBinder(MetadataBinder.QueryTokenVisitor bindMethod)
 {
     this.bindMethod = bindMethod;
 }
Esempio n. 27
0
 /// <summary>
 /// Constructs a EnumBinder with the given method to be used binding the parent token if needed.
 /// </summary>
 /// <param name="bindMethod">Method to use for binding the parent token, if needed.</param>
 internal EnumBinder(MetadataBinder.QueryTokenVisitor bindMethod)
 {
     this.bindMethod = bindMethod;
 }
Esempio n. 28
0
 public ApplyBinder(MetadataBinder.QueryTokenVisitor bindMethod, BindingState state)
     : this(bindMethod, state, null, null)
 {
 }
 /// <summary>
 /// Constructs a InnerPathTokenBinder.
 /// </summary>
 /// <param name="bindMethod">Bind method to use for binding a parent node, if needed.</param>
 internal InnerPathTokenBinder(MetadataBinder.QueryTokenVisitor bindMethod)
 {
     this.bindMethod = bindMethod;
 }
 /// <summary>
 /// Constructs a DottedIdentifierBinder with the given method to be used binding the parent token if needed.
 /// </summary>
 /// <param name="bindMethod">Method to use for binding the parent token, if needed.</param>
 /// <param name="state">State of the metadata binding.</param>
 internal DottedIdentifierBinder(MetadataBinder.QueryTokenVisitor bindMethod, BindingState state)
     : base(bindMethod, state)
 {
 }
Esempio n. 31
0
 public ApplyBinder(MetadataBinder.QueryTokenVisitor bindMethod, BindingState state)
 {
     this.bindMethod = bindMethod;
     this.state = state;
     this.filterBinder = new FilterBinder(bindMethod, state);
 }
Esempio n. 32
0
 /// <summary>
 /// Constructs a FunctionCallBinder with the given method to be used binding the parent token if needed.
 /// </summary>
 /// <param name="bindMethod">Method to use for binding the parent token, if needed.</param>
 /// <param name="state">State of the metadata binding.</param>
 internal FunctionCallBinder(MetadataBinder.QueryTokenVisitor bindMethod, BindingState state)
     : base(bindMethod, state)
 {
 }
Esempio n. 33
0
 /// <summary>
 /// Creates a FilterBinder.
 /// </summary>
 /// <param name="bindMethod">Method to use to visit the token tree and bind the tokens recursively.</param>
 /// <param name="state">State to use for binding.</param>
 internal FilterBinder(MetadataBinder.QueryTokenVisitor bindMethod, BindingState state)
 {
     DebugUtils.CheckNoExternalCallers();
     this.bindMethod = bindMethod;
     this.state      = state;
 }