/// <summary>
        /// Parses the <paramref name="queryUri"/> and binds the query to the metadata provided
        /// then returns a new instance of <see cref="QueryDescriptorQueryNode"/>
        /// describing the query specified by the uri.
        /// </summary>
        /// <param name="queryUri">The absolute URI which holds the query to parse. This must be a path relative to the <paramref name="serviceBaseUri"/>.</param>
        /// <param name="serviceBaseUri">The base URI of the service.</param>
        /// <param name="model">The model to use for binding.</param>
        /// <param name="maxDepth">The maximum depth of any single query part. Security setting to guard against DoS attacks causing stack overflows and such.</param>
        /// <returns>A new instance of <see cref="QueryDescriptorQueryNode"/> which represents the query specified in the <paramref name="queryUri"/>.</returns>
        public static QueryDescriptorQueryNode ParseUri(Uri queryUri, Uri serviceBaseUri, IEdmModel model, int maxDepth)
        {
            ExceptionUtils.CheckArgumentNotNull(model, "model");

            QueryDescriptorQueryToken queryDescriptorQueryToken = QueryDescriptorQueryToken.ParseUri(queryUri, serviceBaseUri, maxDepth);
            MetadataBinder metadataBinder = new MetadataBinder(model);
            return metadataBinder.BindQuery(queryDescriptorQueryToken);
        }
示例#2
0
 public void ParseThenBind()
 {
     var serviceBaseUri = new Uri("http://server/service/");
     var queryUri = new Uri(serviceBaseUri, "Customers(1)");
     var syntacticTree = SyntacticTree.ParseUri(queryUri, serviceBaseUri);
     var model = new ODataModelBuilder().Add_Customer_EntityType().Add_Customers_EntitySet().GetServiceModel();
     MetadataBinder binder = new MetadataBinder(model);
     var semanticTree = binder.BindQuery(syntacticTree);
 }
示例#3
0
 public ObjectList(IEnumerable <T> items, MetadataBinder binder)
 {
     this.Items    = items;
     this.Metadata = binder.BindOutputFields(typeof(T));
 }
示例#4
0
 public static ObjectList <T> AsObjectList <T>(this IEnumerable <T> items, MetadataBinder binder)
 {
     return(new ObjectList <T>(items, binder));
 }