コード例 #1
0
ファイル: InsertEx.cs プロジェクト: yellowforests/Small.Tools
 /// <summary>
 /// Insert SQL
 /// return bool
 /// </summary>
 /// <typeparam name="TEntity">类型参数</typeparam>
 /// <param name="connection">DbConnection</param>
 /// <param name="entity">entity</param>
 /// <param name="transaction">DbTransaction</param>
 /// <returns>object</returns>
 public static bool Insert <TEntity>(this IDbConnection connection, TEntity entity, IDbTransaction transaction = null) where TEntity : class
 {
     try
     {
         DommelMapper.Insert <TEntity>(connection, entity, transaction);
         return(true);
     }
     catch (Exception ex) { throw new Exception(ex.Message); }
 }