Reputation: 3
i am trying to query data from cosmos db with efcore. Where i want to pass multiple expressions to filter the record. My expressions are like:
public void GetData(){
Expression<Func<MyEntity, bool>> val1 = _ => _.Id== 1234;
Expression<Func<MyEntity, bool>> val2 = _ => _.reviewer == "username";
var abc = Or(val1,val2);
dbcontext.GetItemAsync(abc);
}
private static Expression<Func<MyEntity, bool>>
Or(Expression<Func<MyEntity, bool>> expr1,
Expression<Func<MyEntity, bool>> expr2)
{
var body = Expression.OrElse(expr1.Body, expr2.Body);
return Expression.Lambda<Func<MyEntity, bool>>(body, expr1.Parameters[0]);
}
while doing so it always throws error that _ is not defined. Please help.
Upvotes: 0
Views: 668
Reputation: 82
Microsoft have created a database provider for cosmos-db [here](https://learn.microsoft.com/en-us/ef/core/providers/cosmos/?tabs=dotnet-core-cli, although it only supports the SQL API for now
Upvotes: 0