Exemplo n.º 1
0
        public virtual object Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver,
                                      ComponentModel model,
                                      DependencyModel dependency)
        {
            Debug.Assert(CanResolve(context, contextHandlerResolver, model, dependency),
                         "CanResolve(context, contextHandlerResolver, model, dependency)");
            object result = null;

            if (dependency.DependencyKey != null)
            {
                result = Resolve(dependency, additionalArguments[dependency.DependencyKey]);
            }
            return(result ?? Resolve(dependency, additionalArguments[dependency.TargetType]));
        }
Exemplo n.º 2
0
        private object Resolve(DependencyModel dependency, object inlineArgument)
        {
            var targetType = dependency.TargetItemType;

            if (inlineArgument != null)
            {
                if (targetType.IsInstanceOfType(inlineArgument))
                {
                    return(inlineArgument);
                }
                if (CanConvertParameter(targetType))
                {
                    return(converter.PerformConversion(inlineArgument.ToString(), targetType));
                }
            }
            return(null);
        }
Exemplo n.º 3
0
 public virtual bool CanResolve(CreationContext context, ISubDependencyResolver contextHandlerResolver,
                                ComponentModel model,
                                DependencyModel dependency)
 {
     return(HasAdditionalArguments && (CanResolveByKey(dependency) || CanResolveByType(dependency)));
 }