Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
We want to expose support for calling User-Defined Functions via LINQ.
Solution
Collections and Indexes return sets whereas Functions can return anything. We could approach this a few ways, but I chose to make the existing QuerySource implementation work for functions. As such, the type declarations for functions are a little counter intuitive. Developers must type the Function based on the element type it returns. For example, if it returns a single value,
T
inFunction<T>
must be that type. If it returns an array or set, theT
must be the type of the element in the array or set.E.g. 1: If a function returns a string, the type definition must be
Function<string>
. The caller may call.Single()
to get a single value back, or.ToList()
to get a list with a single element.E.g. 2: If a function returns an array or set of strings, the type definition must still be singular, such as
Function<string>
, similar to how one declares aCollection<T>
orIndex<T>
.Changes