[ORM] Using Dapper async in asp.net core 2.1
[ORM] Using Dapper async in asp.net core 2.1 Dapper 是一套輕量化 ORM 套件,有優秀的效能,支援物件對應,與快速查詢,...,等。 Dapper 優點 查詢快速 優秀的效能 支援物件映射 支援預存程序 SP 支援 Bulk 處理 支援強型別 支援動態綁定 支援參數化查詢 支援例舉 Packages Please install Dapper Nuget PM> Install-Package Dapper -Version 1.50.5 建立 Model public class Employee { public int Id {get;set;} public string Name {get;set;} public Datetime birthday {get;set;} } Repository Pattern IRepository public interface IRepository<T> { Task<List<T>> GetAll(); Task<T> GetById(int id); } XXXRepository public class EmployeeRepository : IRepository<Employee> { readonly IConfiguration _config; public EmployeeRepository(IConfiguration config) { this._config = config; } public IDbConnection Connection { get { return new SqlConnection(_config.GetConnectionString("MyConnec...