Castle.ActiveRecord.ActiveRecordBase.DeleteAll C# (CSharp) Метод

DeleteAll() защищенный статический Метод

Deletes all targetType objects, based on the primary keys supplied on pkValues.
protected static DeleteAll ( Type targetType, IEnumerable pkValues ) : int
targetType System.Type The target ActiveRecord type
pkValues IEnumerable A list of primary keys
Результат int
		protected internal static int DeleteAll(Type targetType, IEnumerable pkValues)
		{
			if (pkValues == null)
			{
				return 0;
			}

			int counter = 0;

			foreach (object pk in pkValues)
			{
				Object obj = FindByPrimaryKey(targetType, pk, false);

				if (obj != null)
				{
					ActiveRecordBase arBase = obj as ActiveRecordBase;

					if (arBase != null)
					{
						arBase.Delete(); // in order to allow override of the virtual "Delete()" method
					}
					else
					{
						Delete(obj);
					}

					counter++;
				}
			}

			return counter;
		}

Same methods

ActiveRecordBase::DeleteAll ( Type type ) : void
ActiveRecordBase::DeleteAll ( Type type, String where ) : void

Usage Example

Пример #1
0
 public static void DeleteAll()
 {
     ActiveRecordBase.DeleteAll(typeof(T));
 }
All Usage Examples Of Castle.ActiveRecord.ActiveRecordBase::DeleteAll