Question: Would it be possible to apply your `filter` / queryProcessing logic to standard `IEnumerable` / `IQueryable`
See original GitHub issueSUMMARY
I really like your approach to filter
/ order
/ paginate
data by a URI query string. Especially the filter
aggregation with and
, or
and ()
is nice and very flexible.
I’m currently developing a small command line audio tagger and asked myself, if it would be possible to apply YOUR query processing to a generic IEnumerable
or IQueryable
?
I would love to see a library providing this part of your work for a more generic purpose…
Basically what I’m asking for is something like this:
# my command line tool recursiveley iterates over files in a directory and should be able to filter them
tone dump --sort="size" --page=1 --filter=equals(Artist,'AC/DC') /home/sandreas/music
// any class
class MediaFile {
public long FileSize;
public string Artist;
public IEnumerable<Picture> Covers;
//...
}
// a generic enumberable
IEnumerable<MediaFile> mediaFiles = FileWalker.FindMediaFiles();
// your query processing logic applied to this generic IQueryable?!
var queryProcessor = new QueryProcessor(options.Sort, options.Page, options.Filter);
var filteredMediaFiles = queryProcessor.Apply(mediaFiles);
foreach(var mediaFile in filteredMediaFiles) {
Console.WriteLine(mediaFile.Artist);
}
What do you think? Would that be possible / worth the effort?
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
IEnumerable vs IQueryable for Business Logic or DAL ...
If I need additional filtering, then either: I'll add that to the existing API via parameters, and do the filtering inside my data...
Read more >IQueryable vs. IEnumerable in .NET | by Mohamed Abdeen
IEnumerable interface is useful when your collection is loaded using LINQ or Entity framework and you want to apply a filter on the...
Read more >IEnumerable VS IQueryable
Both have its own importance to query data and data manipulation. Let's see both the features and take advantage of both the features...
Read more >IEnumerable Vs IQueryable In LINQ
In this article I will demonstrate how to write code via IEnumerable and IQueryable and what the differences are between them.
Read more >Standard Query Operators Overview (C#)
The LINQ standard query operators provide query capabilities including filtering, projection, aggregation, and sorting in C#.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve done some experiments and concluded that extracting the querying logic from JADNC is not feasible at this time. This is due to dependencies on the resource graph, EF Core, HttpContext, and various others. However the good news is: you can already reuse JADNC today for what you’re trying to accomplish. Two approaches:
In either case, based on command-line switches you need to construct a query string (matching what JADNC accepts when running as an ASP.NET Web API).
Glad to help. I wish you good luck with your project.