/// <summary> Deletes all the <typeparamref name="TEntity"/> records by given IDs. </summary> /// /// <typeparam name="TEntity"> Type of the entity. </typeparam> /// <param name="ids"> The identifiers of records. </param> /// <param name="transaction"> The SQL transaction. </param> /// /// <returns> Number of rows affected (integer) </returns> public int DeleteAll <TEntity>(OracleTransaction transaction, IEnumerable <long> ids) where TEntity : class { int result = 0; var entityInfo = RepositorySetting.GetEntity2Info(typeof(TEntity)); var commandText = string.Format("{0}_Delete", entityInfo.DbObjectName); foreach (var id in ids) { result += SimpleAccess.ExecuteNonQuery(transaction, commandText, CommandType.StoredProcedure, new[] { OracleParametersExtensions.ToDataParam(id, (string)"Id") }); } return(result); }
/// <summary> Soft delete. </summary> /// /// <typeparam name="TEntity"> Type of the entity. </typeparam> /// <param name="id"> The identifier. </param> /// /// <returns> . </returns> public int SoftDelete <TEntity>(long id) where TEntity : class { //var name = typeof(TEntity).Name; var entityInfo = RepositorySetting.GetEntityInfo(typeof(TEntity)); var commandText = string.Format("{0}_SoftDelete", entityInfo.Name); return(SimpleAccess.ExecuteNonQuery(commandText, CommandType.StoredProcedure, new[] { OracleParametersExtensions.ToDataParam(id, (string)"id") })); }
/// <summary> Deletes the given ID. </summary> /// /// <typeparam name="TEntity"> Type of the entity. </typeparam> /// <param name="transaction"> The SQL transaction. </param> /// <param name="id"> The identifier. </param> /// /// <returns> . </returns> public int Delete <TEntity>(OracleTransaction transaction, long id) where TEntity : class { //var name = typeof(TEntity).Name; var entityInfo = RepositorySetting.GetEntity2Info(typeof(TEntity)); var commandText = string.Format("{0}_Delete", entityInfo.DbObjectName); var result = SimpleAccess.ExecuteNonQuery(transaction, commandText, CommandType.StoredProcedure, new[] { OracleParametersExtensions.ToDataParam(id, (string)"Id") }); return(result); }