예제 #1
0
        public object Create(IBuilderContext context,
                             object buildKey)
        {
            Guard.ArgumentNotNull(context, "context");

            return(Activator.CreateInstance(BuilderStrategy.GetTypeFromBuildKey(buildKey),
                                            GetParameters(context, null)));
        }
예제 #2
0
        public IBuilderPolicy Get(Type policyInterface,
                                  object buildKey,
                                  bool localOnly)
        {
            Type buildType;

            if (!BuilderStrategy.TryGetTypeFromBuildKey(buildKey, out buildType) || !buildType.IsGenericType)
            {
                return
                    (GetNoDefault(policyInterface, buildKey, localOnly) ??
                     GetNoDefault(policyInterface, null, localOnly));
            }

            return
                (GetNoDefault(policyInterface, buildKey, localOnly) ??
                 GetNoDefault(policyInterface, buildType.GetGenericTypeDefinition(), localOnly) ??
                 GetNoDefault(policyInterface, null, localOnly));
        }