Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

CosmosLinq.InvokeUserDefinedFunction(String, Object[]) Method

Definition

Namespace:
Microsoft.Azure.Cosmos.Linq
Assembly:
Microsoft.Azure.Cosmos.Client.dll
Package:
Microsoft.Azure.Cosmos v3.58.0
Package:
Microsoft.Azure.Cosmos v3.59.0-preview.0
Source:
CosmosLinq.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

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


Feedback

Was this page helpful?