public QueryResult( ODataQueryOptions <TModel> queryOptions, IQueryable <TModel> queryable, System.Web.Http.ApiController controller, int maxPageSize, long?totalResults, Func <ODataQueryOptions <TModel>, ODataQuerySettings, long?, Uri> generateNextLink) { _queryOptions = queryOptions; _queryable = queryable; _controller = controller; _totalResults = totalResults; _generateNextLink = generateNextLink; if (_totalResults.HasValue && generateNextLink != null) { _isPagedResult = true; } // todo: if we decide to no longer support projections //AllowedQueryOptions = AllowedQueryOptions.All & ~AllowedQugeteryOptions.Select _validationSettings = new ODataValidationSettings() { MaxNodeCount = 250 }; _querySettings = new ODataQuerySettings(QueryResultDefaults.DefaultQuerySettings) { PageSize = maxPageSize }; }
public QueryResult( ODataQueryOptions <TModel> queryOptions, IQueryable <TModel> queryable, System.Web.Http.ApiController controller, int maxPageSize, bool?customQuery) : this(queryOptions, queryable, controller, maxPageSize, null, null, customQuery) { }
public QueryResult( ODataQueryOptions <TModel> queryOptions, IQueryable <TModel> queryable, System.Web.Http.ApiController controller, int maxPageSize, long?totalResults, Func <ODataQueryOptions <TModel>, ODataQuerySettings, long?, Uri> generateNextLink, bool?customQuery) { _queryOptions = queryOptions; _queryable = queryable; _controller = controller; _totalResults = totalResults; _generateNextLink = generateNextLink; _customQuery = customQuery; var queryDictionary = HttpUtility.ParseQueryString(queryOptions.Request.RequestUri.Query); _semVerLevelKey = SemVerLevelKey.ForSemVerLevel(queryDictionary["semVerLevel"]); if (_totalResults.HasValue && generateNextLink != null) { _isPagedResult = true; } // todo: if we decide to no longer support projections //AllowedQueryOptions = AllowedQueryOptions.All & ~AllowedQugeteryOptions.Select _validationSettings = new ODataValidationSettings() { MaxNodeCount = 250 }; _querySettings = new ODataQuerySettings(QueryResultDefaults.DefaultQuerySettings) { PageSize = maxPageSize }; }
/// <summary> /// Submits a notification to all matching registered WebHooks. To match, the <see cref="WebHook"/> must be registered by the /// current <see cref="ApiController.User"/> and have a filter that matches one or more of the actions provided for the notification. /// </summary> /// <param name="controller">The <see cref="ApiController"/> instance.</param> /// <param name="notifications">The set of notifications to include in the WebHook.</param> /// <returns>The number of <see cref="WebHook"/> instances that were selected and subsequently notified about the actions.</returns> public static Task <int> NotifyAsync(this ApiController controller, params NotificationDictionary[] notifications) { return(NotifyAsync(controller, notifications, predicate: null)); }
/// <summary> /// Submits a notification to all matching registered WebHooks. To match, the <see cref="WebHook"/> must be registered by the /// current <see cref="ApiController.User"/> and have a filter that matches one or more of the actions provided for the notification. /// </summary> /// <param name="controller">The <see cref="ApiController"/> instance.</param> /// <param name="action">The action describing the notification.</param> /// <param name="data">Optional additional data to include in the WebHook request.</param> /// <param name="predicate">A function to test each <see cref="WebHook"/> to see whether it fulfills the condition. The /// predicate is passed the <see cref="WebHook"/> and the user who registered it. If the predicate returns <c>true</c> then /// the <see cref="WebHook"/> is included; otherwise it is not.</param> /// <returns>The number of <see cref="WebHook"/> instances that were selected and subsequently notified about the actions.</returns> public static Task <int> NotifyAsync(this ApiController controller, string action, object data, Func <WebHook, string, bool> predicate) { var notifications = new NotificationDictionary[] { new NotificationDictionary(action, data) }; return(NotifyAsync(controller, notifications, predicate)); }
/// <summary> /// Submits a notification to all matching registered WebHooks. To match, the <see cref="WebHook"/> must be registered by the /// current <see cref="ApiController.User"/> and have a filter that matches one or more of the actions provided for the notification. /// </summary> /// <param name="controller">The <see cref="ApiController"/> instance.</param> /// <param name="action">The action describing the notification.</param> /// <param name="data">Optional additional data to include in the WebHook request.</param> /// <returns>The number of <see cref="WebHook"/> instances that were selected and subsequently notified about the actions.</returns> public static Task <int> NotifyAsync(this ApiController controller, string action, object data) { var notifications = new NotificationDictionary[] { new NotificationDictionary(action, data) }; return(NotifyAsync(controller, notifications, predicate: null)); }