Delete() public method

Deletes the instance from the database.
If within a SessionScope the operation is going to be on hold until NHibernate (or you) decides to flush the session.
public Delete ( ) : void
return void
Exemplo n.º 1
0
        protected internal static int DeleteAll(Type targetType, IEnumerable pkValues)
        {
            if (pkValues == null)
            {
                return(0);
            }

            int c = 0;

            foreach (int 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
                    {
                        ActiveRecordBase.Delete(obj);
                    }
                    c++;
                }
            }
            return(c);
        }
Exemplo n.º 2
0
 public virtual void Delete()
 {
     ActiveRecordBase.Delete(this);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Deletes the instance from the database.
 /// </summary>
 /// <param name="instance">The ActiveRecord instance to be deleted</param>
 public static void Delete(object instance)
 {
     ActiveRecordBase.Delete(instance);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Deletes the instance from the database.
 /// </summary>
 /// <param name="instance">The ActiveRecord instance to be deleted</param>
 protected internal static void Delete(T instance)
 {
     ActiveRecordBase.Delete(instance);
 }