/// <summary> /// 执行事务 /// </summary> /// <typeparam name="T">实体类型</typeparam> /// <param name="entity">实体</param> /// <param name="conn">数据库连接</param> /// <param name="sqlTran">sql事务</param> /// <returns>影响行数</returns> public static int Insert <T>(this T entity, SqlConnection conn, SqlTransaction sqlTran) where T : new() { SqlEntityOper seo = new SqlEntityOper(); return(seo.ExecuteNonquery(entity, DbType.Insert, sqlTran, true, conn)); }
/// <summary> /// 添加 /// </summary> /// <typeparam name="T">实体类型</typeparam> /// <param name="entity">实体</param> /// <returns>影响行数</returns> public static int Insert <T>(this T entity) where T : new() { SqlEntityOper seo = new SqlEntityOper(); return(seo.ExecuteNonquery(entity, DbType.Insert)); }