Is it possible to select distinct property values of an entity where the column name is not known in advance - received by the method as a string from the client.
For filtering purposes I want to make a HTTP POST Ajax request to the server from the browser which will contain the field name as a key, and this will be available to the server as a string.
I know I am going to have to manually map any differences between the ViewModel and the POCO class used by Entity Framework, but is it possible to construct an Entity framework query without the strongly typed property - by using reflection for example.
I'd probably try to implement this where the data was determined by controller, calling a generic method of the base repository with the entity class as the type. Is this possible or do I need to construct a method for each possible field?
Equally, should I be attempting to do this, or instead constructing ADO.NET SQL commands with the field as a parameter (mapping from ViewModel to SQL column names)?