select statement without where clause in Dapper targeting .net3.5 framework

c# dapper

Question

I am using Dapper micro-ORM in my project where i want to select all the records from table. Below is my code.

 var result = connection.Query<Department>("Select * From Department");

and i am getting the following error

No Overload for method 'Query' takes 1 argument

My project's target framework is .net 3.5. If i just change the project's target framework to .net 4.0, and re-install dapper (using nuget) everything is working good.

i don't want to use where clause (i.e. no additional parameter for query method). Is there a way to run this query using dapper targeting .net 3.5 framework?

Accepted Answer

In the current code, you must pass a param argument in the NET35 build. This can be null. Try:

var result = connection.Query<Department>("select * from Department", null);



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why