예제 #1
0
        private static void ProcessForClass(IReflectionService reflectionService, ComponentModel model)
        {
            var classAttribute = reflectionService.GetCustomAttribute <NamedAttribute>(model.Implementation);

            if (classAttribute != null)
            {
                model.Name = classAttribute.Name;
            }
        }
예제 #2
0
        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;
                }
            }
        }