public void InspectField(IComponentInfo ctx, IKernel kernel, FieldInfo f) { var settingAttr = GetSettingAttribute(f); if (settingAttr != null && !string.IsNullOrEmpty(settingAttr.Name)) { appSettingInjections.Add(CreateFieldInjection(f, settingAttr)); return; } var manyAttr = GetInjectManyAttribute(f); if (manyAttr != null) { injections.Add(CreateFieldInjection(kernel, f, manyAttr)); return; } var injectAttr = GetInjectAttribute(f); if (injectAttr != null) { injections.Add(CreateFieldInjection(kernel, f, injectAttr)); return; } //var componentAttr = f.GetAttribute<ComponentAttribute>(true); var componentAttr = componentAttributeVisitor.VisitField(f); if (componentAttr != null) { exports.Add(new FieldExportInfo { Id = componentAttr != null ? componentAttr.Id : null, Field = f, Getter = DynamicMethodFactory.GetGetter(f) }); return; } }
private static InjectManyAttribute GetInjectManyAttribute(FieldInfo f) { //return f.GetAttribute<InjectManyAttribute>(true); return(injectManyAttributeVisitor.VisitField(f)); }
private static SettingAttribute GetSettingAttribute(FieldInfo f) { //return f.GetAttribute<SettingAttribute>(false); return(settingAttributeVisitor.VisitField(f)); }
private void InspectFields(IComponentInfo ctx, IKernel kernel, Type componentType) { componentType.GetFields(FieldFlags) .Where(p => !ignoreVisitor.VisitField(p)) .ForEach(p => injectionInspector.InspectField(ctx, kernel, p)); }