I have a form containing some CheckedListBoxes as seen here:

I am able to drill down my data from the first two columns via:
var take = await cmax.dbases.Where(w => statuses.Any(a => w.statusname == a)
&& portfolios.Any(a => w.portfolio == a)).Take(Math.Min((int) takeAmount, count - taken)).ToListAsync();
I would like to then be able to Select() specific data based on my selection in the 2nd two CheckedListBoxes, however, the only method I know to Select Data with EntityFramework is:
Select(s => new { s.ColumnNameHere, s.OtherColumnNameHere });
How may I select the specific properties(columns) based on the user input?
You may want to use DynamicLinq
With it it's possible to write select statements like that (example from site above):
var query = db.Customers.Select("new (CompanyName as Name, Phone)");
So you need to create a string a list of fields and concatenated them or something else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With