I am trying to execute a stored procedure this way:
var filterValues= context.Database.SqlQuery<FilterProcedureDTO>(
"[dbo].[sp_GetFilterValues] @FieldID", new SqlParameter("FieldID", filterID))
.ToList();
the issue is the filter values that come up have diffrent column name with each call as the user changes the filter on the view,though all come up as objects with an int column and string column,it seems they are bound to the specified model ie FilterProcedureDTO..which looks like
public class FilterProcedureDTO
{
public FilterProcedureDTO() {
//empty constructor
}
public int production_lineID { get; set; }
public string production_line_desc { get; set; }
}
so if the call produces taskID and task_desc this wont work anymore. Another thing is some IDs are int32 and some are int16 so the code is not executing perfectly because of periodic exceptions
How can I get the stored procedure to return generic objects,just recognising the datatypes and not variable names too?