/// <summary>
        /// Write details of a part definition to a text writer.
        /// </summary>
        /// <param name="part">Part definition to print.</param>
        /// <param name="output">Destination.</param>
        public static void Write(PartDefinitionInfo part, System.IO.TextWriter output)
        {
            output.WriteLine("[Part] {0}", CompositionElementTextFormatter.DescribeCompositionElement(part.PartDefinition));

            if (part.IsPrimaryRejection)
                output.WriteLine("  [Primary Rejection]");

            foreach (var ed in part.PartDefinition.ExportDefinitions)
                output.WriteLine("  [Export] {0}", CompositionElementTextFormatter.DisplayCompositionElement(ed));

            foreach (var id in part.ImportDefinitions)
            {
                output.WriteLine("  [Import] {0}", CompositionElementTextFormatter.DisplayCompositionElement(id.ImportDefinition));
                foreach (var e in id.Actuals)
                {
                    output.WriteLine("    [SatisfiedBy] {0}", CompositionElementTextFormatter.DescribeCompositionElement(e));
                }

                if (id.Exception != null)
                    output.WriteLine("    [Exception] {0}", id.Exception);

                if (!(id.ImportDefinition is ContractBasedImportDefinition))
                    output.WriteLine("    [Not Contract-Based]");
                else
                    foreach (var potential in id.UnsuitableExportDefinitions)
                    {
                        output.WriteLine("    [Unsuitable] {0}", CompositionElementTextFormatter.DescribeCompositionElement(potential.ExportDefinition));
                        foreach (var issue in potential.Issues)
                            output.WriteLine("      [Because] {0}, {1}", issue.Reason, issue.Message);
                    }
            }
        }
 /// <summary>
 /// Create an UnsuitableExportDefinitionInfo.
 /// </summary>
 /// <param name="target">Import for which the export is unsuitable.</param>
 /// <param name="exportDefinition">Unsuitable export.</param>
 /// <param name="partDefinition">Part definition that provided the export.</param>
 public UnsuitableExportDefinitionInfo(
     ContractBasedImportDefinition target,
     ExportDefinition exportDefinition,
     PartDefinitionInfo partDefinition)
 {
     ExportDefinition = exportDefinition;
     PartDefinition = partDefinition;
     _issues = CheckForRequiredMetadataIssues(target, exportDefinition)
                     .Concat(CheckForTypeIdentityIssues(target, exportDefinition))
                     .Concat(CheckForCreationPolicyIssues(target, partDefinition.PartDefinition))
                     .ToArray();
 }
 /// <summary>
 /// Create an UnsuitableExportDefinitionInfo.
 /// </summary>
 /// <param name="target">Import for which the export is unsuitable.</param>
 /// <param name="exportDefinition">Unsuitable export.</param>
 /// <param name="partDefinition">Part definition that provided the export.</param>
 public UnsuitableExportDefinitionInfo(
     ContractBasedImportDefinition target,
     ExportDefinition exportDefinition,
     PartDefinitionInfo partDefinition)
 {
     ExportDefinition = exportDefinition;
     PartDefinition   = partDefinition;
     _issues          = CheckForRequiredMetadataIssues(target, exportDefinition)
                        .Concat(CheckForTypeIdentityIssues(target, exportDefinition))
                        .Concat(CheckForCreationPolicyIssues(target, partDefinition.PartDefinition))
                        .ToArray();
 }
예제 #4
0
        /// <summary>
        /// Write details of a part definition to a text writer.
        /// </summary>
        /// <param name="part">Part definition to print.</param>
        /// <param name="output">Destination.</param>
        public static void Write(PartDefinitionInfo part, System.IO.TextWriter output)
        {
            output.WriteLine("[Part] {0}", CompositionElementTextFormatter.DescribeCompositionElement(part.PartDefinition));

            if (part.IsPrimaryRejection)
            {
                output.WriteLine("  [Primary Rejection]");
            }

            foreach (var ed in part.PartDefinition.ExportDefinitions)
            {
                output.WriteLine("  [Export] {0}", CompositionElementTextFormatter.DisplayCompositionElement(ed));
            }

            foreach (var id in part.ImportDefinitions)
            {
                output.WriteLine("  [Import] {0}", CompositionElementTextFormatter.DisplayCompositionElement(id.ImportDefinition));
                foreach (var e in id.Actuals)
                {
                    output.WriteLine("    [SatisfiedBy] {0}", CompositionElementTextFormatter.DescribeCompositionElement(e));
                }

                if (id.Exception != null)
                {
                    output.WriteLine("    [Exception] {0}", id.Exception);
                }

                if (!(id.ImportDefinition is ContractBasedImportDefinition))
                {
                    output.WriteLine("    [Not Contract-Based]");
                }
                else
                {
                    foreach (var potential in id.UnsuitableExportDefinitions)
                    {
                        output.WriteLine("    [Unsuitable] {0}", CompositionElementTextFormatter.DescribeCompositionElement(potential.ExportDefinition));
                        foreach (var issue in potential.Issues)
                        {
                            output.WriteLine("      [Because] {0}, {1}", issue.Reason, issue.Message);
                        }
                    }
                }
            }
        }
예제 #5
0
 static void PrintPartDefinition(PartDefinitionInfo pdi, TextWriter writer, bool verbose)
 {
     if (verbose)
     {
         PartDefinitionInfoTextFormatter.Write(pdi, writer);
         writer.WriteLine();
     }
     else
     {
         writer.WriteLine(CompositionElementTextFormatter.DisplayCompositionElement(pdi.PartDefinition));
     }
 }
 public PartInfoViewModel(PartDefinitionInfo partDefinitionInfo, MainViewModel mainViewModel)
 {
     this._partDefinitionInfo = partDefinitionInfo;
     this._mainViewModel = mainViewModel;
 }
예제 #7
0
 public PartInfo(PartDefinitionInfo partDefinitionInfo)
 {
     this._partDefinitionInfo = partDefinitionInfo;
 }
 private static string GetPartDefinitionKey(PartDefinitionInfo pd)
 {
     return CompositionElementTextFormatter.DisplayCompositionElement(pd.PartDefinition);
 }