public void InjectAll(IService service, object instance) { IEnumerable <IMember> members = InstanceMembersFinder.FindMembers(service); foreach (IMember member in members) { MemberValueSetter.SetValue(member, instance); } }
public void InjectAll(IService service, IReadOnlyContainer container, object instance) { IEnumerable <ServiceFlag> flags = ServiceAttributeFinder.ProvideFlags(service.Flags, ServiceFlagConstants.TryInject); foreach (ServiceFlag flag in flags) { Type declarationType = DeclarationTypeProvider.ProvideDeclarartionType(flag.Member); object value = InjectValueProvider.ProvideValue(declarationType, container); ValueSetter.SetValue(flag.Member, instance, value); } }
public void InjectAll(IService service, object instance) { IEnumerable <ServiceFlag> flags = ServiceAttributeProvider.ProvideFlags(service.Flags, ServiceFlagConstants.Auto); foreach (ServiceFlag flag in flags) { Type declarationType = DeclarationTypeProvider.ProvideDeclarartionType(flag.Member); object value = AutoValueGenerator.GenerateValue(declarationType); MemberValueSetter.SetValue(flag.Member, instance, value); } }
public void InjectAll(IService service, IReadOnlyContainer container, object instance) { IEnumerable <ServiceFlag> injections = InjectsProvider.ProvideFlags(service); foreach (ServiceFlag injectFlag in injections) { Type type = DeclarationTypeProvider.ProvideDeclarartionType(injectFlag.Member); object value = InjectValueProvider.ProvideValue(type, container); if (value == null) { throw new InjectException(type); } ValueSetter.SetValue(injectFlag.Member, instance, value); } }