-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Description
Hi, would it be possible to integrate support for named / positional parameters, mainly to boost performance by utilizing query plan caching / prepared queries?
I could imagine something like this:
var emailParam = new QueryParameter("[email protected]");
var data = userCtx.Query<User>()
.Where(x => x.Email == emailParam.Value)
.Select(u => new
{
FirstName = u.FirstName,
LastName = u.LastName,
})
.UsePreparedQuery("my-prepared-query") // maybe name can be optional?
// it might be possible to generate a unique name by hashing the expression tree or something like that?
.ToList();The QueryParameter class could be detected in the expression visitors and it would automatically generate a named parameter at its position and add its value to the final query with AddNamedParameter.
Additionally the UsePreparedQuery extension would mark the generated query to be registered as a prepared query with couchbase to improve performance for future executions.
I'm quite new to couchbase but have some knowledge regarding linq expression trees, so I hope this proposal makes sense.
Metadata
Metadata
Assignees
Labels
No labels