private void AddMethodInjectionPoints(TypeDescription description, MethodInfo[] methods) { foreach (MethodInfo method in methods) { object[] injections = method.GetCustomAttributes(INJECT_ATTRIBUTE_TYPE, true); if (injections.Length == 0) { continue; } Inject attr = injections [0] as Inject; MethodInjectionPoint injectionPoint = new MethodInjectionPoint(method, attr.names, attr.optional); description.AddInjectionPoint(injectionPoint); } }
private void AddPropertyInjectionPoints(TypeDescription description, Type type) { PropertyInfo[] properties = type.GetProperties(); foreach (PropertyInfo property in properties) { object[] injections = property.GetCustomAttributes(INJECT_ATTRIBUTE_TYPE, true); if (injections.Length == 0) { continue; } Inject attr = injections [0] as Inject; object key = attr.name; MappingId mappingId = new MappingId(property.PropertyType, key); PropertyInjectionPoint injectionPoint = new PropertyInjectionPoint(mappingId, property, attr.optional); //injectParameters); description.AddInjectionPoint(injectionPoint); } }
private void AddFieldInjectionPoints(TypeDescription description, Type type) { FieldInfo[] fields = type.GetFields(); foreach (FieldInfo field in fields) { object[] injections = field.GetCustomAttributes(INJECT_ATTRIBUTE_TYPE, true); if (injections.Length == 0) { continue; } Inject attr = injections [0] as Inject; object key = attr.name; MappingId mappingId = new MappingId(field.FieldType, key); FieldInjectionPoint injectionPoint = new FieldInjectionPoint(mappingId, field, attr.optional);// injectParameters.optional == 'true', injectParameters); description.AddInjectionPoint(injectionPoint); } }
private void AddPostConstructMethodPoints(TypeDescription description, MethodInfo[] methods) { List <OrderedInjectionPoint> orderedInjectionPoints = new List <OrderedInjectionPoint> (); foreach (MethodInfo method in methods) { object[] injections = method.GetCustomAttributes(POST_CONSTRUCT_ATTRIBUTE_TYPE, true); if (injections.Length == 0) { continue; } PostConstruct attr = injections [0] as PostConstruct; PostConstructInjectionPoint injectionPoint = new PostConstructInjectionPoint(attr.order, method); orderedInjectionPoints.Add(injectionPoint); } orderedInjectionPoints.Sort(SortInjectionPoints); foreach (OrderedInjectionPoint point in orderedInjectionPoints) { description.AddInjectionPoint(point); } }