private void SetPrerequisiteImports() { IEnumerable <ImportDefinition> members = ImportDefinitions.Where(import => import.IsPrerequisite); // NOTE: Dev10 484204 The validation is turned off for post imports because of it broke declarative composition UseImportedValues(members, SetExportedValueForImport, false); }
/// <summary> /// If the part is rejected, find the most likely parts in the composition /// that caused this rejection. /// </summary> /// <param name="maximumAnalysisDepth">The maximum depth of the composition /// graph to be inspected.</param> /// <returns></returns> public IEnumerable <PartDefinitionInfo> FindPossibleRootCauses(int maximumAnalysisDepth) { return(ImportDefinitions .Where(id => id.IsBroken) .SelectMany(id => id .UnsuitableExportDefinitions .Where(ed => ed.PartDefinition.IsRejected && ed.PartDefinition != this) .SelectMany(ed => ed.PartDefinition.FindPossibleRootCauses(--maximumAnalysisDepth)) .Take(maximumAnalysisDepth)) .Append(this) .Where(pd => pd.IsPrimaryRejection) .Distinct() .ToArray()); }
// this is called under a lock private void EnsureGettable() { // If we're already composed then we know that // all pre-req imports have been satisfied if (_initialCompositionComplete) { return; } // Make sure all pre-req imports have been set foreach (ImportDefinition definition in ImportDefinitions.Where(definition => definition.IsPrerequisite)) { if (!this._importValues.ContainsKey(definition)) { throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, Strings.InvalidOperation_GetExportedValueBeforePrereqImportSet, definition.ToElement().DisplayName)); } } }