ContentService.Saving event in 6.1.6 doesn't match documentation
So I've read in the official documentation that you should no longer use the ContentService.Created event anymore manipulate new documents:
"Both the ContentService.Creating and ContentService.Created events have been obsoleted."
Instead it says to use the ContentService.Saving method:
"The ContentService.Saving and ContentService.Saved events will always trigger before and after an entity has been persisted. You can determine if an entity is brand new in either of those events. In the Saving event - before the entity is persisted - you can check the entity's HasIdentity property which will be 'false' if it is brand new."
However, I've just checked, and when I create a brand new content node in 6.1.6 the HasIdentity property is actually set to true in the Saving event. This contradicts the documentation.
void ContentService_Saving(IContentService service, Umbraco.Core.Events.SaveEventArgs<IContent> e)
{
foreach (var doc in e.SavedEntities)
{
// Check whether it is a new item - this replaces ContentService.Creating
if (!doc.HasIdentity)
{
// doc.HasIdentity == true even when creating a brand new document
}
}
}
Can anyone shed any light on whether this is a bug or whether the documentation is wrong?
ContentService.Saving event in 6.1.6 doesn't match documentation
So I've read in the official documentation that you should no longer use the ContentService.Created event anymore manipulate new documents:
Instead it says to use the ContentService.Saving method:
However, I've just checked, and when I create a brand new content node in 6.1.6 the HasIdentity property is actually set to true in the Saving event. This contradicts the documentation.
Example Code
void ContentService_Saving(IContentService service, Umbraco.Core.Events.SaveEventArgs<IContent> e) { foreach (var doc in e.SavedEntities) { // Check whether it is a new item - this replaces ContentService.Creating if (!doc.HasIdentity) { // doc.HasIdentity == true even when creating a brand new document } } }
is working on a reply...