private static void ProcessForClass(IReflectionService reflectionService, ComponentModel model) { var classAttribute = reflectionService.GetCustomAttribute <NamedAttribute>(model.Implementation); if (classAttribute != null) { model.Name = classAttribute.Name; } }
private static void ProcessForParameters(IReflectionService reflectionService, ComponentModel model) { var parameters = model.Dependencies .OfType <ConstructorDependencyModel>() .Where(x => !x.IsPrimitiveTypeDependency) .ToList(); foreach (var parameter in parameters) { var parameterName = parameter.DependencyKey; var parameterInfo = parameter.Constructor.Constructor.GetParameters().First(x => x.Name == parameterName); var attribute = reflectionService.GetCustomAttribute <NamedAttribute>(parameterInfo); if (attribute != null) { parameter.DependencyKey = attribute.Name; } } }