public ConfigurationResolverArgs RunConfigurationPipeline(AbstractTypeCreationContext abstractTypeCreationContext) { var configurationArgs = new ConfigurationResolverArgs(GlassContext, abstractTypeCreationContext, abstractTypeCreationContext.RequestedType, this); configurationArgs.Parameters = abstractTypeCreationContext.Parameters; _configurationResolver.Run(configurationArgs); return(configurationArgs); }
/// <summary> /// Instantiates the object. /// </summary> /// <param name="abstractTypeCreationContext">The abstract type creation context.</param> /// <returns></returns> /// <exception cref="System.NullReferenceException">Configuration Resolver pipeline did not return a type. Has the type been loaded by Glass.Mapper. Type: {0}.Formatted(abstractTypeCreationContext.RequestedType.FullName)</exception> public object InstantiateObject(AbstractTypeCreationContext abstractTypeCreationContext) { //run the pipeline to get the configuration to load var configurationArgs = new ConfigurationResolverArgs(GlassContext, abstractTypeCreationContext); _configurationResolver.Run(configurationArgs); if (configurationArgs.Result == null) { throw new NullReferenceException("Configuration Resolver pipeline did not return a type. Has the type been loaded by Glass.Mapper. Type: {0}".Formatted(abstractTypeCreationContext.RequestedType.FullName)); } var config = configurationArgs.Result; //Run the object construction var objectArgs = new ObjectConstructionArgs(GlassContext, abstractTypeCreationContext, config, this); _objectConstruction.Run(objectArgs); return(objectArgs.Result); }