Multi language doc type always IsDirty when updated through ContentService
Hi all,
I have 2 languages set up, English (default) and Chinese.
I have a service which processes a daily feed and creates/updates node data accordingly via the ContentService.
I am only interested in updating/publishing the English version through the Content Service. Most properties are invariant but there are some variant properties.
I'm creating a new node for the default culture, like below, or getting the existing node if it already exists:
node = new Content("name", parentId, contentType, "en-US");
I am setting my invariant properties like so:
node.SetValue("propertyAlias", "propertyValue");
I am defining the culture on my variant properties like so:
Because the service runs daily, I only want to save/publish a node if it is dirty for performance.
If I do node.IsDirty();, it's always true, even when no properties have changed, and CultureInfos is always the only dirty property. Inspecting node.CultureInfos it just returns an array ["Umbraco.Core.Models.ContentCultureInfos"] which doesn't feel correct. Even using node.IsCultureEdited("en-US"); also always returns true.
I don't know how to get around this IsDirty() always being true. Am I setting my values wrong for invariant cultures, or missing something?
Further to this, inspecting the raw node data in the database, the only change is to this dt value in the cd property, which i'm assuming is something to do with the CultureInfos property.
You could mayhaps try the IRememberBeingDirty interface?
var test = (IRememberBeingDirty)node;
var testDirty = test.IsDirty(); //This should be true if a property is dirty, and false if nothing has changed...
I do not know why there is a need for IRememberBeingDirty though. Since it seems kind of strange to keep an IsDirty() on IContent that doesn't do what it appears it's supposed to do...
Multi language doc type always IsDirty when updated through ContentService
Hi all,
I have 2 languages set up, English (default) and Chinese.
I have a service which processes a daily feed and creates/updates node data accordingly via the ContentService.
I am only interested in updating/publishing the English version through the Content Service. Most properties are invariant but there are some variant properties.
I'm creating a new node for the default culture, like below, or getting the existing node if it already exists:
I am setting my invariant properties like so:
I am defining the culture on my variant properties like so:
Because the service runs daily, I only want to save/publish a node if it is dirty for performance.
If I do
node.IsDirty();
, it's always true, even when no properties have changed, andCultureInfos
is always the only dirty property. Inspecting node.CultureInfos it just returns an array["Umbraco.Core.Models.ContentCultureInfos"]
which doesn't feel correct. Even usingnode.IsCultureEdited("en-US");
also always returns true.I don't know how to get around this IsDirty() always being true. Am I setting my values wrong for invariant cultures, or missing something?
Any help/advice would be greatly appreciated.
Thanks
Further to this, inspecting the raw node data in the database, the only change is to this
dt
value in thecd
property, which i'm assuming is something to do with theCultureInfos
property.First update:
Second update:
The
dt
value can't be set on every save/publish otherwise nodes would always be dirty...You could mayhaps try the IRememberBeingDirty interface?
I do not know why there is a need for IRememberBeingDirty though. Since it seems kind of strange to keep an IsDirty() on IContent that doesn't do what it appears it's supposed to do...
Anyways, hope this helps :)
is working on a reply...