I am rebuilding our reporting system using EF, where as our old system used a lot of dynamic SQL (bad i know), so i would like to do it using Linq, so it uses parameterized queries etc.
In a report a user can choose which columns of data they want to view. Now how can i take these values and return an SQL statement using Linq and get the columns i need? I wonder if i should even bother and just return all the data, then just show the columns the user wants on screen, which may be want i need to do, but thought i would ask anyway.
So lets take the following Linq example, i say i would only like the Id, Name and Town, how could i do this. Currently i have something similar to
var columns = new List<string>() { "Id", "Name", "Town" };
return _context.Data
.Where(e => e.Name == "test")
.ToList();
Is this even possible?