Ejemplo n.º 1
0
        internal bool Delete()
        {
            if (Backer.IsNew)
            {
                throw new NotFoundException(string.Format("Trying to delete a new object. Class: {0}, Id: {1}", Backer.ModlType, Id));
            }

            if (Backer.IsDeleted)
            {
                throw new NotFoundException(string.Format("Trying to delete a deleted object. Class: {0}, Id: {1}", Backer.ModlType, Id));
            }

            Materializer.Delete(Definitions.GetStorage(Id, Backer), Settings.Get(Backer.ModlType));
            Backer.IsDeleted = true;

            return(true);
        }