다음을 통해 공유


CosmosLinq.InvokeUserDefinedFunction(String, Object[]) Method

Definition

Helper method to invoke User Defined Functions via Linq queries in the Azure Cosmos DB service.

public static object InvokeUserDefinedFunction (string udfName, params object[] arguments);
static member InvokeUserDefinedFunction : string * obj[] -> obj
Public Shared Function InvokeUserDefinedFunction (udfName As String, ParamArray arguments As Object()) As Object

Parameters

udfName
String

The UserDefinedFunction name

arguments
Object[]

The arguments of the UserDefinedFunction

Returns

Placeholder for the udf result.

Examples

// Equivalent to SELECT * FROM books b WHERE udf.toLowerCase(b.title) = 'war and peace'" 
IQueryable<Book> queryable = client
    .GetContainer("database", "container")
    .GetItemLinqQueryable<Book>()
    .Where(b => CosmosLinq.InvokeUserDefinedFunction("toLowerCase", b.Title) == "war and peace");

FeedIterator<Book> bookIterator = queryable.ToFeedIterator();
while (feedIterator.HasMoreResults)
{
    FeedResponse<Book> responseMessage = await feedIterator.ReadNextAsync();
    DoSomethingWithResponse(responseMessage);
}

Remarks

This is a stub helper method for use within LINQ expressions. Cannot be called directly. Refer to https://docs.microsoft.com/azure/cosmos-db/sql-query-linq-to-sql for more details about the LINQ provider. Refer to https://docs.microsoft.com/azure/cosmos-db/stored-procedures-triggers-udfs for more details about user defined functions.

Applies to

See also