CarrotCMSData/LinqToSqlExtensions.cs
/// <summary>
/// Immediately deletes all entities from the collection with a single delete command.
/// </summary>
/// <typeparam name="TEntity">Represents the object type for rows contained in <paramref name="table"/>.</typeparam>
/// <param name="table">Represents a table for a particular type in the underlying database containing rows are to be deleted.</param>
/// <typeparam name="TPrimaryKey">Represents the object type for the primary key of rows contained in <paramref name="table"/>.</typeparam>
/// <param name="primaryKey">Represents the primary key of the item to be removed from <paramref name="table"/>.</param>
/// <returns>The number of rows deleted from the database (maximum of 1).</returns>
/// <remarks>
/// <para>If the primary key for <paramref name="table"/> is a composite key, <paramref name="primaryKey"/> should be an anonymous type with property names mapping to the property names of objects of type <typeparamref name="TEntity"/>.</para>
/// </remarks>
Immediately deletes all entities from the collection with a single delete command.
Immediately deletes all entities from the collection with a single delete command .
public static int DeleteByPK<TEntity>( this Table<TEntity> table, object primaryKey ) where TEntity : class
		{
			DbCommand delete = table.GetDeleteByPKCommand<TEntity>( primaryKey );
			var parameters = from p in delete.Parameters.Cast<DbParameter>()
							 select p.Value;
			return table.Context.ExecuteCommand( delete.CommandText, parameters.ToArray() );
		}
public static int DeleteByPK < TEntity > ( this Table < TEntity > table , object primaryKey ) where TEntity : class { DbCommand delete = table . GetDeleteByPKCommand < TEntity > ( primaryKey ) ; var parameters = from p in delete . Parameters . Cast < DbParameter > ( ) select p . Value ; return table . Context . ExecuteCommand ( delete . CommandText , parameters . ToArray ( ) ) ; }
Immediately deletes all entities from the collection with a single delete command.
Immediately deletes all entities from the collection with a single delete command .
The number of rows deleted from the database (maximum of 1).
The number of rows deleted from the database ( maximum of 1 ) .
Table<TEntity>
this
primaryKey
object
Represents the primary key of the item to be removed from .
Represents the primary key of the item to be removed from .
table
Represents a table for a particular type in the underlying database containing rows are to be deleted.
Represents a table for a particular type in the underlying database containing rows are to be deleted .
typeparam
Represents the object type for rows contained in .
Represents the object type for rows contained in .
typeparam
Represents the object type for the primary key of rows contained in .
Represents the object type for the primary key of rows contained in .
remarks
If the primary key for  is a composite key,  should be an anonymous type with property names mapping to the property names of objects of type .
If the primary key for is a composite key should be an anonymous type with property names mapping to the property names of objects of type .