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

InternalDelete() приватный статический Метод

Deletes the instance from the database.
private static InternalDelete ( object instance, bool flush ) : void
instance object The ActiveRecord instance to be deleted
flush bool if set to true, the operation will be followed by a session flush.
Результат void
		private static void InternalDelete(object instance, bool flush)
		{
			if (instance == null) throw new ArgumentNullException("instance");

			EnsureInitialized(instance.GetType());

			ISession session = holder.CreateSession(instance.GetType());

			try
			{
				session.Delete(instance);

				if (flush)
				{
					session.Flush();
				}
			}
			catch (ValidationException)
			{
				holder.FailSession(session);

				throw;

			}
			catch (Exception ex)
			{
				holder.FailSession(session);

				throw new ActiveRecordException("Could not perform Delete for " + instance.GetType().Name, ex);
			}
			finally
			{
				holder.ReleaseSession(session);
			}
		}