Clean up LINQ statements?
In an ideal situation I would just do the query on the
Cells
table, but that table gets updated with ALL the cells, each time a user uploads a file, and there wouldn't be a way to track which data they want to use then (couldn't remove the old data if it was wrong, etc).
What I have here works great, but is there a way to clean up these queries? I.E. Anyway to shorten this? Do I need all the calls here? Does calling Distinct() on each query even make sense (is that slower/faster)? etc.3 Replies
If there's a common base class or interface for CashFlow, Balance and Benchmark, you can make method that returns the query from a DbSet of that base type
There actually is... hm i didn't think of that.
More precisely a generic method with the base type as a constraint so you can return set of the exact type needed by the caller
If not, have some delegates as parameters to fill the gaps