コード例 #1
0
 /// <summary>
 /// Query
 /// 根据主键“ID”
 /// </summary>
 /// <typeparam name="TEntity">类型参数</typeparam>
 /// <param name="connection">DbConnection</param>
 /// <param name="id">主键ID值</param>
 /// <returns>TEntity</returns>
 public static TEntity Query <TEntity>(this IDbConnection connection, object id) where TEntity : class
 {
     try
     {
         return(DommelMapper.Get <TEntity>(connection, id));
     }
     catch (Exception ex) { throw new Exception(ex.Message); }
 }
コード例 #2
0
 public override TEntity Get(TPrimaryKey id) => DommelMapper.Get <TEntity>(Connection, id, Transaction) ?? throw new Exception("EntityNotFoundException");