Can't Delete Post Because IsNew = true

Mar 26, 2008 at 5:31 PM
I was trying to delete a post on my blog (using the delete admin link) and I noticed it wasn't deleting. After stepping through it, I learned that DeletePost was never being called on my BlogProvider was never being called because on the BusinessBase.Update() method there is a check for !IsNew

if (this.IsDeleted)
{
       if (!this.IsNew)
       {
		action = SaveAction.Delete;
		OnSaving(this, action);
		DataDelete();
	}
}

What exactly does IsNew mean? Why does a post have to be marked IsNew in order to be deleted? Is there supposed to be a call to MarkOld() that is supposed to happen before Delete is called?

Just in case it has something to do with the BlogProvider I am using I figured I would note I am using a new provider I just wrote which uses SubSonic to access a SqlServer backed. More details here
Coordinator
Mar 27, 2008 at 9:13 PM
When IsNew is true, then it means that the Post haven't been saved into XML/database yet. That's why it doesn't make sense to delete something if it hasn't been persisted to the database yet. For instance:

Post post = new Post();
post.Delete();
post.Save();

This above example shows a new instance of a Post being created. Then it is marked for deletion and finally Saved. Since the new post hasn't been saved before it was deleted, there is no reason to call the datastore to delete it when Save() is called.