I’m struggling w/some Dapper code. I have a singular, all encompassing list that I’m using in a couple different calls (handled by my stored procedure). This works well in most cases, but I’m running into issues where list items known to have a value are returning NULL to the list. I am reusing this list throughout.. maybe that’s an issue?
This has happened to me in three different scenarios in this project, so I’m confident there’s something I’m missing.
I wish I could share more, but the code is privileged. Here’s the sp call. Now picture a list which is 50 items wide, but depending up on the parameter, only certain fields are returned from by the stored procedure. Again, I would expect varying numbers of fields to be NULL, but I am also certain that fields I expect are being returned NULL, why I do receive others. For what its worth, NULLs may appear to my list at any position (first, middle, last item).
public List<buildrec> RecBuilder(string recType)
{
using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(cnstr("myDB")))
{
var Params = new DynamicParameters();
Params.Add("rtype", recType);
return connection.Query<buildCMEDI>("mySP" , new { RTYPE = recType}, commandTimeout: 180).ToList();
}
}
Ex. I pass the parameter of redtruck, all stored information on red trucks is returned
Towing_capacity, Engine_size, make, model, Number_doors, convertible (in this example, I’d expect to have values for all but convertible.
If I passed bluecar, I’d expect to have values for all, but Towing_capacity and any convertibles.
continuing the example I receive no information for bluecar : convertible, though I am certain there is data.
I’ve check numerous times, spelling, sp calls, etc. If I call the SP from SSMS, works as intended. when reviewing the raw list results in VS, I see the intended data. However, all is returned to my list variables a NULL.
I tried to be thorough, please share any thoughts.. I’m stumped.