I want to write a selector using System.Linq.Expressions
and pass it as an argument to custom Find(selector)
method, but which columns should be grabbed is decided by a list of strings, where every string is a required column name.
public Task<List<object>> ExportFromServer(IEnumerable<string> columnNames)
{
// it is a typical solution, how to use columns string name here?
Expression<Func<DirectoryCountry, object>> selector = country => new { country.Code, country.CountryCode };
return Find(selector);
}