private void CreateInstanceProvider(MethodBase method, ProviderAttribute providerAttribute, bool isSingleton) { InjectionProvider provider = isSingleton ? new SingletonInjectionProvider(method) : new InjectionProvider(method); if (providerAttribute.Name != null) { this.namedProviderMap.Add(providerAttribute.Name, provider); } if (providerAttribute.ProvidesType != null) { this.providerMap.Add(providerAttribute.ProvidesType, provider); } }
private void CreateSetProvider(MethodBase method, ProviderAttribute providesSetAttribute, bool isSingleton) { InjectionProvider mappedProvider; SetInjectionProvider setProvider = null; if (providesSetAttribute.Name != null) { if (this.namedProviderMap.TryGetValue(providesSetAttribute.Name, out mappedProvider)) { setProvider = mappedProvider as SetInjectionProvider; } else { setProvider = new SetInjectionProvider(); this.namedProviderMap.Add(providesSetAttribute.Name, setProvider); } } if (providesSetAttribute.ProvidesType != null) { if (this.providerMap.TryGetValue(providesSetAttribute.ProvidesType, out mappedProvider)) { setProvider = mappedProvider as SetInjectionProvider; } else { setProvider = new SetInjectionProvider(); this.providerMap.Add(providesSetAttribute.ProvidesType, setProvider); } } if (setProvider != null) { InjectionProvider provider = isSingleton ? new SingletonInjectionProvider(method) : new InjectionProvider(method); setProvider.AddProvider(provider); } }
public void AddProvider(InjectionProvider provider) { this.providerList.Add(provider); }