c# - Unknown Return Types from SQL Queries? -


i have wpf application has methods pull t sql queries database table:

enter image description here

  public list<awardschartparameters> getawardschartparameters(string country, string articletype)     {                              var query = (from in _context.tbquerytable                       a.articletype == articletype                       select a.colselection + " " + a.fromtable + " " + a.whereclause + " " + a.orderby);           string queryresult = query.firstordefault().tostring();           return ((iobjectcontextadapter)_context).objectcontext.executestorequery<awardschartparameters>(queryresult).tolist();     } 

so depending on articletype passed in parameter ui, returns 1 of several result sets pivot query defined in table.

i trying write class each possible result set e.g.

public class awardschartparameters {     public string operator_int_name { get; set; }     public int countall { get; set; } } 

this specific query in table return list of string & int therefore can pull in results list<awardschartparameters> & chart them in ui. way need class hold possible result sets table table grows.

is there way of creating dynamic list or class built @ run time depending on result set query. example user's 1st query may return list of strings, 2nd query returns list of strings & ints?

i using entity framework therefore mapping entities concrete classes in sql server db in other parts of code result sets queries in table this, have concrete dependencies results structure & beginning smell bad code...


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -