Example #1
0
        private static IDiagramFactory InstantiateDiagramFactory(Type exportedType)
        {
            ConstructorInfo ctor;

            if (!exportedType.TryGetPublicParameterlessConstructor(out ctor))
                throw new NPlantException("ClassDiagramFactory's are expected to have a public parameterless constructor.  '{0}' does not meet this expectation.".FormatWith(exportedType.FullName));

            return (IDiagramFactory)ctor.Invoke(new object[0]);
        }
Example #2
0
        private static DiscoveredDiagram InstantiateDiagram(Type exportedType)
        {
            ConstructorInfo ctor;

            if (!exportedType.TryGetPublicParameterlessConstructor(out ctor))
                throw new NPlantException("Diagrams are expected to have a public parameterless constructor.  '{0}' does not meet this expectation.".FormatWith(exportedType.FullName));

            return new DiscoveredDiagram(exportedType.Namespace, (IDiagram)ctor.Invoke(new object[0]));
        }