コード例 #1
0
        public async Task <IMergeGraphSyncer?> SyncEmbedded(ContentItem contentItem)
        {
            _logger.LogDebug("Syncing embedded {ContentItem}.", contentItem.ToString());

            JObject?graphSyncPartContent = (JObject?)contentItem.Content[nameof(GraphSyncPart)];

            if (graphSyncPartContent == null)
            {
                return(null);
            }

            var embeddedMergeContext = _graphMergeContext !.ChildContexts
                                       .Single(c => c.ContentItem.ContentItemId == contentItem.ContentItemId);

            _logger.LogDebug("Found existing GraphMergeContext for {ContentItem}.", contentItem.ToString());

            var embeddedMergeGraphSyncer = (MergeGraphSyncer)embeddedMergeContext.MergeGraphSyncer;

            if (!embeddedMergeGraphSyncer._syncNameProvider.GraphSyncPartSettings.PreexistingNode)
            {
                await((MergeGraphSyncer)embeddedMergeContext.MergeGraphSyncer).SyncEmbedded();
            }

            return(embeddedMergeGraphSyncer);
        }
コード例 #2
0
        public async Task DeleteEmbedded(ContentItem contentItem)
        {
            if (contentItem.Content.GraphSyncPart == null)
            {
                return;
            }

            var embeddedDeleteContext = _graphDeleteItemSyncContext !.ChildContexts
                                        .Single(c => c.ContentItem.ContentItemId == contentItem.ContentItemId);

            var embeddedDeleteGraphSyncer = (DeleteGraphSyncer)embeddedDeleteContext.DeleteGraphSyncer;

            if (embeddedDeleteGraphSyncer._syncNameProvider.GraphSyncPartSettings.PreexistingNode)
            {
                return;
            }

            await((DeleteGraphSyncer)embeddedDeleteContext.DeleteGraphSyncer).DeleteEmbedded();
        }