could not map single column?

Apr 19, 2012 at 8:55 AM
Edited Apr 19, 2012 at 8:55 AM
Could not map: Year
return CreateContext().Sql("select Year from Inquisition group by Year order by Year desc").Query<int>();

the database is mysql. year is int.

what should i do?

Apr 19, 2012 at 9:04 AM
Edited Apr 19, 2012 at 9:06 AM

Hi, try this instead:

return CreateContext().Sql("select Year from Inquisition group by Year order by Year desc").QueryValues<int>();

 

The reason to use QueryValues instead of just Query is that int is a scalar type and not an entity type.

Does it work? 

Regards,
Lars-Erik Kindblad 

 

 

Apr 19, 2012 at 9:12 AM

it works! :)

thank you!