I have a scenario where i am passing table name as parameter to SQL Server stored procedure and that stored procedure returns the data from that table, so the data structure that stored procedure returns varies based on the parameter(table name) i am passing to the stored procedure.
In my existing implementation where the data structure is fixed i.e the columns returned by the stored procedure do no change we are using predefined DTO models which looks like below.
public IList<UserDetailsDTO> GetUserDetails(int userId)
{
Dictionary<string, object> params = new Dictionary<string, object>();
params.Add("@UserId",userId);
return ExecuteProcedure<UserDetailsDTO>("spGetUserDetails", params);
}
Now with my new requirement where the data structure returned by the stored proc varies based on the parameter i.e the Table name being passed to it, I am not sure how i can have my DTO models dynamic.
Any inputs or suggestions on this ?
1