Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm writing a custom handler for a datatype that stores references both to other nodes (by integer Node ID) and media object (also by integer Node ID), wrapped in some JSON with some other properties.
I have no trouble getting my handler to run and found it easy to just convert the int IDs into a GUID when packing and reverse that conversion when extracting. The question is, are media files supposed to be dependencies or resources?
The documentation really doesn't explain clearly what the difference is; so I've just been using item.Dependencies.Add(mediaGuid, ItemProviderIds.mediaItemProviderGuid); Is there any particular reason to use item.Resources at all? It seems to work correctly without any calls to item.Resources.Add(), but I don't know if that's just getting lucky or what.
Also, in debugging the code, I notice that
public override void PackagingProperty(Item item, ContentProperty propertyData) gets invoked 3 times with the exact same arguments (there's only one use of the particular data type on this page anyway, and I haven't chosen "include all nodes below this.").
public override void PackagingProperty(Item item, ContentProperty propertyData)
I have two custom Providers, and when I put breakpoints on their PackagingProperty calls, I see
In all 6 cases, Item is the same, and across the three Foo's the propertyData is the same, likewise the 3 Bar's all match on their propertyData.
During extraction, each ExtractingProperty() is called only once. Foo, then Bar. Again, this all seems to work, but I'm trying to diagnose a problem where Courier sometimes creates a duplicate copy of the node I'm trying to transfer, which then breaks all subsequent transfers. Seemed like my custom handlers were a good place to start, but I don't see anything overtly wrong with them. Is there any explanation for why Courier invokes PackagingProperty() three times per property?
That was my first impression, but media seems to be a little odd in that it's both the Umbraco Node and the filesystem object. Adding it as a dependency seems to work; it adds the media metadata and transfers the file. So I guess it's "dependency for nodes, resources for files that are not nodes."
Now if only anyone could explain why PackagingProperty() gets invoked multiple times...
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted