1
Vote

Ivy.UserRegistration.DataAccess.UserDao.Delete method

description

On line 173 of the UserDao class, the Delete method calls the Update method. Shouldn't there be a sequence which opens a connection to the database, runs a delete SP etc? I can't see how the Delete method deletes anything.

comments

mrinmoyd wrote Oct 3, 2012 at 6:10 PM

This entity needs a soft delete so it is actually updating a flag as deleted.
public bool Delete(User userEntity)
    {
        bool IsOperationSuccessful = false;
        try
        {
            userEntity.EntityState = EntityState.Changed;
            userEntity.Sys_IsDeleted = true;
            if (Update(userEntity))
            {
                IsOperationSuccessful = true;
            }


        }
        catch (Exception ex)
        {
            System.Diagnostics.Debug.Print(ex.Message);
            throw ex;
        }
        return IsOperationSuccessful;
    }

mrinmoyd wrote Oct 3, 2012 at 6:14 PM

Once an user record is created, the user can perform other operations like feedback or blog etc. so there is a chance that other records will have reference to this user record. That is why user is such type of entity which once created should never be deleted physically.

wrote Feb 12, 2013 at 9:24 PM