I would (and have) started to use Dapper. To use your example would be like (written from memory):
public List<CustomerEntity> GetCustomerList()
{
using (DbConnection connection = CreateConnection())
{
return connection.Query<CustomerEntity>("procToReturnCustomers", commandType: CommandType.StoredProcedure).ToList();
}
}
CreateConnection()
would handle accessing your db and returning a connection.
Dapper handles mapping datafields to properties automatically. It also supports multiple types and result sets and is very fast.
Query returns IEnumerable
hence the ToList()
.