I'm still new to MVC and dapper ORM. Suppose I use dapper for MVC and and when I try to build solution, it showing message: 'SqlConnection does not contain a definition for'Query' and no extension method 'Query' accepting a first argument of type 'SqlConnection'.
here is the code:
using System.Collections.Generic;
using System.Data.SqlClient;
public string Connectionstring = @"Data Source = KL - PT - 049\sqlexpress;Initial Catalog = Record; Integrated Security = True";
public IEnumerable<Customer> GetCustomers()
{
using (SqlConnection conn = new SqlConnection(Connectionstring))
{
conn.Open();
var customer = conn.**Query**<Customer>("Select * from Customer");
return customer;
}
my question is: does the Query above should be fine if I use that way? since I already use data.sqlClient reference?