public IActivationStrategy?GetStrategy(IBindingRequest request, CachedResolutionPolicy cache) { var finalTargetType = genericTemplate.MakeGenericType(request.DesiredType.GetGenericArguments()); var activator = cache.Bind(request.DesiredType, true).DoBinding( TypeActivatorFactory.CreateTypeActivator( finalTargetType, constructorSelector) ); options?.Invoke(activator); return(activator.GetFinalFactory()); }
public StandardTypeResolutionPolicy() { var cache = new CachedResolutionPolicy(InterceptionPolicy.AsInterceptionRule()); Policies.Add(new ArgumentBindingPolicy()); Policies.Add(cache); Policies.Add(new MemorizeResult(cache, new GetIocServiceTypes())); Policies.Add(new GenericResolutionPolicy(cache)); Policies.Add(new MemorizeResult(cache, new EnumerateMultipleBindingsPolicy(this))); Policies.Add(new MemorizeResult(cache, new FunctionsIntoFactories())); Policies.Add(new MemorizeResult(cache, new TuplesToScopeResolutionPolicy())); Policies.Add(new MemorizeResult(cache, new SelfBindByDefault())); Policies.Add(new MemorizeResult(cache, new ConventionResolutionPolicy())); Policies.Add(new DefaultValuePolicy()); }
public MemorizeResult(CachedResolutionPolicy cache, ITypeResolutionPolicy innerPolicy) { this.cache = cache; InnerPolicy = innerPolicy; }
public GenericResolutionPolicy(CachedResolutionPolicy cache) { this.cache = cache; }