The OrigoDb engine can compile and cache parameterized LINQ queries passed as a strings using the following extension methods, defined in the namespace
The linqQuery must be a valid c# expression. The expression is evaluated with the provided arguments and the result is returned to the caller.
db within the query to reference the model during execution.
Access the arguments in the
args param array using
The type of each parameter is derived from the actual arguments on the first invocation. Subsequent invocations expect arguments that match the signature. Example:
Note how the
Customer.Name property is accessed within the query.
The query is compiled the first time it is evaluated. The compilation depends on the number and types of arguments passed. Subsequent calls with the same linqQuery must pass the same number and types of arguments.
Beware of the risk of arbitrary code injection. There is a test case in the source with an example exploit.