0
votes

I am trying to get a previous version of a published node to do comparison to the current node. I have found Document.GetContentFromVersion but can't seem to find the equivalent in NodeFactory or a way to convert Content to a Node type. Can anyone help?

1

1 Answers

1
votes

There isn't an equivalent to Document.GetContentFromVersion in NodeFactory as NodeFactory gets its data from the umbraco.config cache and Document pulls it's data from the database (See Difference Between Node and Document).

You can get at the properties of a Content object the same way you would with a Document or a Node:

var old = Document.GetContentFromVersion(version);
var oldProperty = old.getProperty("propertyAlias");

For comparisons, Node:

var nodeProperty = node.GetProperty("propertyAlias");

if (oldProperty.Value == nodeProperty.Value)
{
    ...
}

Document:

var docProperty = node.getProperty("propertyAlias");
if (oldProperty.Value == docProperty.Value)
{
    ...
}