I have a model (M) that contains two tables(A and B). When I run the code from my MVC application to get the rows from (A) like this:
var context =new ClaimsHistorical();
context.CommandTimeout = 120;
IList<ClaimsSLAMonth> list = context.ClaimsSLAMonths.Where(x=>x.timeperiod == "2012-03").ToList();
var final = list.Select(c => new[]{
c.branch.ToString().Trim(), c.NLPR_SLA.ToString() ?? null, c.NLPR_count.ToString() ?? null, c.NLPR_AvgLocktime.ToString() ?? null, c.NLPR_PIn.ToString() ?? null, c.NLPR_POut.ToString() ?? null,
c.NLGA_SLA.ToString() ?? null, c.NLGA_count.ToString() ?? null, c.NLGA_AvgLocktime.ToString() ?? null, c.NLGA_PIn.ToString() ?? null, c.NLGA_POut.ToString() ?? null
});
When I set a breakpoint for the list.Select to check the command it gives me the SQL which works in SSMS
It returns 0 rows (no errors, warnings, messages). I copied the SQL query that is being "executed" by the EF and pasted it to SQL Server Management Studio, it returns me the 5 or so rows.
Also when I run the exact same code except I substitute the table name to (B) I get the rows correctly. I tried to recreate the Model and it still returns nothing. Am I missing something obvious, or is there something seriously wrong?