public ILifecycleExtension Create(Type type, object viewModel) { var viewModelConstructorArgument = new ImplementedTypesConstructorArgument(viewModel, false); var viewModelAsObjectConstructorArgument = new TypedConstructorArgument(typeof(object), viewModel, false); return(this.resolutionRoot.Get(type, viewModelConstructorArgument, viewModelAsObjectConstructorArgument) as ILifecycleExtension); }
public object Build(IRibbonToolDefinition definition) { Type toolDefinitionInterfaceType = definition.GetType() .GetAllInterfaces() .Single(x => !IgnoredInterfaces.Contains(x)); var definitionArgument = new TypedConstructorArgument(toolDefinitionInterfaceType, definition, true); Type factoryType = typeof(IRibbonToolFactory <>).MakeGenericType(toolDefinitionInterfaceType); object factory = this.resolutionRoot.Get(factoryType, definitionArgument); return(factoryType.GetMethod(FactoryMethodName).Invoke(factory, new object[0])); }