예제 #1
0
        public void ConfigureFamily(TypePath pluginTypePath, Action <PluginFamily> action)
        {
            var pluginType = pluginTypePath.FindType();
            var family     = _pluginGraph.Families[pluginType];

            action(family);
        }
예제 #2
0
        public void can_parse_assembly_qualified_generics()
        {
            Type sampleGenericType = typeof (IConcept<AWidget>);
            string genericAssemblyQualifiedName = sampleGenericType.AssemblyQualifiedName;

            var path = new TypePath(genericAssemblyQualifiedName);
            path.FindType().ShouldEqual(sampleGenericType);
        }
        public DoctorReport RunReport(string bootstrapperTypeName)
        {
            var report = new DoctorReport
            {
                Result = DoctorResult.Success
            };


            IBootstrapper bootstrapper;

            try
            {
                var  path             = new TypePath(bootstrapperTypeName);
                Type bootstrapperType = path.FindType();
                bootstrapper = (IBootstrapper)Activator.CreateInstance(bootstrapperType);
            }
            catch (Exception e)
            {
                report.Result        = DoctorResult.BootstrapperCouldNotBeFound;
                report.ErrorMessages = e.ToString();

                return(report);
            }

            try
            {
                bootstrapper.BootstrapStructureMap();

                PluginGraph graph = ObjectFactory.PluginGraph;

                if (graph.Log.ErrorCount > 0)
                {
                    report.ErrorMessages = graph.Log.BuildFailureMessage();
                    report.Result        = DoctorResult.ConfigurationErrors;
                }
                else
                {
                    writeConfigurationAndValidate(report, graph);
                }


                return(report);
            }
            catch (StructureMapConfigurationException ex)
            {
                report.ErrorMessages = ex.Message;
                report.Result        = DoctorResult.ConfigurationErrors;

                return(report);
            }
            catch (Exception ex)
            {
                report.Result        = DoctorResult.BootstrapperFailure;
                report.ErrorMessages = ex.ToString();

                return(report);
            }
        }
예제 #4
0
        public void can_parse_assembly_qualified_generics()
        {
            var sampleGenericType            = typeof(IConcept <AWidget>);
            var genericAssemblyQualifiedName = sampleGenericType.AssemblyQualifiedName;

            var path = new TypePath(genericAssemblyQualifiedName);

            path.FindType().ShouldEqual(sampleGenericType);
        }
예제 #5
0
 public void ConfigureFamily(TypePath pluginTypePath, Action <PluginFamily> action)
 {
     try
     {
         Type         pluginType = pluginTypePath.FindType();
         PluginFamily family     = _pluginGraph.FindFamily(pluginType);
         action(family);
     }
     catch (Exception ex)
     {
         _pluginGraph.Log.RegisterError(103, ex, pluginTypePath.AssemblyQualifiedName);
     }
 }
예제 #6
0
 public void WithType(TypePath path, string context, Action <Type> action)
 {
     try
     {
         Type type = path.FindType();
         action(type);
     }
     catch (StructureMapException ex)
     {
         RegisterError(ex);
     }
     catch (Exception ex)
     {
         RegisterError(131, ex, path.AssemblyQualifiedName, context);
     }
 }
예제 #7
0
 public static void WithType(this GraphLog log, TypePath path, string context, Action<Type> action)
 {
     try
     {
         Type type = path.FindType();
         action(type);
     }
     catch (StructureMapException ex)
     {
         log.RegisterError(ex);
     }
     catch (Exception ex)
     {
         log.RegisterError(131, ex, path.AssemblyQualifiedName, context);
     }
 }
예제 #8
0
        public void CanBuildTypeCreatedFromType()
        {
            var path = new TypePath(GetType());

            path.FindType();
        }
예제 #9
0
 public void CanBuildTypeCreatedFromType()
 {
     var path = new TypePath(GetType());
     path.FindType();
 }
예제 #10
0
 public void ConfigureFamily(TypePath pluginTypePath, Action<PluginFamily> action)
 {
     try
     {
         Type pluginType = pluginTypePath.FindType();
         PluginFamily family = _pluginGraph.FindFamily(pluginType);
         action(family);
     }
     catch (Exception ex)
     {
         _pluginGraph.Log.RegisterError(103, ex, pluginTypePath.AssemblyQualifiedName);
     }
 }