Reputation: 522
Is there any way to call a sql view by using Dapper c# ?
I already know how to call stored procedures with that, but when it comes to views I have no idea how to do that.
Upvotes: 9
Views: 11138
Reputation: 1062780
A view works like a table from the perspective of queries, including how filters and parameters work - so something like:
string region = ...
var data = connection.Query<SomeType>(
"select * from SomeView where Region = @region", new { region }).AsList();
Upvotes: 12