/// <summary> /// Selecter 快速 FirstOrDefaultAsync by pk 方法 /// </summary> public static async Task <M> GetAsync <M>(this IDbConnection conn, object pkValue) where M : class { var selecter = conn.Selecter <M>(); var option = new QuickOption().GetCondition() as IDictionary <string, object>; option[selecter.DC.SqlProvider.GetTablePK(typeof(M).FullName)] = pkValue; return(await selecter.Where(option).FirstOrDefaultAsync()); }
/// <summary> /// Updater 快速 UpdateAsync update fields by pk 方法 /// </summary> public static async Task <int> UpdateAsync <M>(this IDbConnection conn, object pkValue, dynamic filedsObject) where M : class { var updater = conn.Updater <M>(); var option = new QuickOption().GetCondition() as IDictionary <string, object>; option[updater.DC.SqlProvider.GetTablePK(typeof(M).FullName)] = pkValue; return(await updater.Set(filedsObject as object).Where(option).UpdateAsync()); }