question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Linq Queryable Decorator

See original GitHub issue

Someone may know the answer to this but as we do not expose the LinqQueryable how would a consumer chain extra linq methods other than just a .Where(x => ...) clause, would we need to add some sort of extra API for this?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mumby0168commented, Sep 29, 2021

@IEvangelist what are your thoughts on this API?

        /// <summary>
        /// Get's an <see cref="IEnumerable{TItem}"/> collection of <see cref="IItem"/>
        /// </summary>
        /// <param name="queryBuilder"></param>
        /// <returns>A collection of item instances returned by the given LINQ <paramref name="queryBuilder"/> Cosmos SQL query.</returns>
        ValueTask<IEnumerable<TItem>> GetByQueryAsync(Action<CosmosQueryableDecorator<TItem>> queryBuilder);

This work’s nicely for the LINQ operators that result in an IQueryable<TItem> but not so much for using operators such as .Select(item => item.Id) I did kind of go down the root of the this API but then this kind of break’s the pattern of the whole Repository by now not returning a TItem this was it what do you think?

ValueTask<TReturn> QueryAsync<TReturn>(Func<CosmosQueryableDecorator<TItem>, TReturn> queryBuilder);

The API above does add a lot of complications internally to the library.

1reaction
mumby0168commented, Sep 23, 2021

@IEvangelist what were your thoughts on this?

So this would scope the consumers to the Supported LINQ Operators, if so I like it.

Yes, that would be the plan using a wrapper similar to what I put above. I was thinking just to start with the basic ones to begin with such as OrderBy

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to implement custom LINQ Provider for decorator?
I have a project that allows for some computed properties and business logic implemented via decorator and interfaces that controls all access ...
Read more >
Composed LINQ Queries using the Decorator Pattern
Query Decorators ​​ Personally, I use the decorator pattern to solve the problem of decomposing LINQ queries into more granular and reusable parts ......
Read more >
IQueryable Interface (System.Linq)
Provides functionality to evaluate queries against a specific data source wherein the type of the data is not specified.
Read more >
IEnumerable and IQueryable in C# - Dot Net Tutorials
In this article, I am going to discuss IEnumerable and IQueryable in C# with examples. Both IQueryable and IEnumerable are interfaces in C#....
Read more >
IEnumerable VS IQueryable
In LINQ to query data from database and collections, we use IEnumerable and IQueryable for data manipulation. IEnumerable is inherited by ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found