I'm creating a Cosmos service, it has basic CRUD but I need to implement a method that receiving an expression with LINQ executes it against the DB. I have this:
var result = new List<T>(); using var iterator = container.GetItemLinqQueryable<T>().Where(x => x.Id != Guid.Empty).ToFeedIterator<T>(); while (iterator.HasMoreResults) { var response = await iterator.ReadNextAsync(); result.AddRange(response); } return result;
I can only think on creating a method that returns the result of GetItemLinqQueryable then in the client I apply the where, or select or whatever and store in a "var query" and then pass that to ANOTHER method in Cosmos that does the ToFeedIterator thing and continues with the rest. Is there any better way?
https://stackoverflow.com/questions/65837998/create-a-cosmos-service-with-a-method-that-runs-a-linq-lambda January 22, 2021 at 09:06AM
没有评论:
发表评论