public int GetTotalIgnoredNodeCount() { return(IgnoredModelNodes.Count()); }
protected override void OnBeforeDeployModelNode(object modelHost, ModelNode modelNode) { // temporary measure // we need to restoreoriginal value of .RequireSelfProcessing to avoid any model changes // set 'ProcessedRequireSelfProcessingValue' in property bag for the further OriginalRequireSelfProcessingValue = modelNode.Options.RequireSelfProcessing; // lookup node and definition in model state // mark as modelNode.Options.RequireSelfProcessing true/false based on state var currentModelNode = modelNode; var currentDefinition = modelNode.Value; var prevModelHash = GetPreviousModelHash(); var isSingleIdentity = IsSingletonIdentityDefinition(currentDefinition); if (isSingleIdentity) { TraceService.InformationFormat(0, "Detected singleton definition [{0}]. Incremental update for such definitions isn't supported yet. Skipping.", currentDefinition); return; } else { TraceService.InformationFormat(0, "Calculating hashes for node and definition:[{0}]", currentDefinition); } //var currentNodeHashHash = HashService.GetHashCode(currentModelNode); var currentDefinitionHash = GetHashString(currentDefinition); var currentDefinitionIdentityKey = GetDefinitionIdentityKey(currentDefinition); var currentDefinitionIdentityHash = GetHashString(currentDefinitionIdentityKey); var currentDefinitionFullPath = GetDefinitionFullPath(false); var currentDefinitionFullPathHash = GetDefinitionFullPath(true); //TraceService.InformationFormat(0, " -node hash:[{0}]", currentNodeHashHash); TraceService.InformationFormat(0, " - definition hash:[{0}]", currentDefinitionHash); TraceService.InformationFormat(0, " - definition full path:[{0}]", currentDefinitionFullPath); TraceService.InformationFormat(0, " - definition full path hash:[{0}]", currentDefinitionFullPathHash); var prevModeNodeHashes = prevModelHash.ModelNodes .Where(h => h.DefinitionFullPathHash == currentDefinitionFullPathHash); // same definition is added multiple times // this could be // - toggling, such as feature activation toggling // - intentional toggling of the field or something // - intentional adding definition twice // we don't change anyting with the yet preferring to skip incremental provision detection if (prevModeNodeHashes.Count() > 1) { TraceService.InformationFormat(0, "Found more than one previous model node by path hash:[{0}]", currentDefinitionFullPathHash); TraceService.Information(0, "Not changing anything, incremental provision can't detect right path to change here."); IgnoredModelNodes.Add(currentModelNode); return; } var prevModeNodeHash = prevModeNodeHashes.FirstOrDefault(); if (prevModeNodeHash != null) { TraceService.InformationFormat(0, "Found previous model node by path hash:[{0}]", currentDefinitionFullPathHash); if (prevModeNodeHash.DefinitionHash != currentDefinitionHash) { TraceService.Information(0, "Definition hashes don't macth. Setting .Options.RequireSelfProcessing = true if it's not."); if (!modelNode.Options.RequireSelfProcessing) { modelNode.Options.RequireSelfProcessing = true; } } else { TraceService.Information(0, "Definition hashes match. Setting .Options.RequireSelfProcessing = false."); modelNode.Options.RequireSelfProcessing = false; } } else { TraceService.InformationFormat(0, "Cannot find previous model hash. Leaving .Options.RequireSelfProcessing as it is:[{0}]", currentModelNode.Options.RequireSelfProcessing); } }