No mapping exists from object type System.Collections.Generic.List when executing stored proc with parameters in EF 4.3

In case someone else comes across this…

I created the parameters as a List and then in the SqlQuery call I passed it with a .ToArray(). Worked for me. Here’s the modified code below…

var parameters = new List<object>(); 
parameters.Add(new SqlParameter("param1", param1Value)); 
parameters.Add(new SqlParameter("param2", param2Value)); 
IList<XXXViewModel> XXXList = 
_context.Database.SqlQuery<XXXViewModel>("spXXX @param1, @param2", parameters.ToArray()).ToList(); 

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)