/// <summary> Process this. </summary> /// /// <remarks> Ken, 10/5/2020. </remarks> /// /// <param name="entityObject"> The entity object. </param> /// <param name="entityPropertyItem"> The entity property item. </param> /// <param name="annotationType"></param> /// <param name="typeBuilder"> The type builder. </param> /// <param name="appHierarchyNodeObject"> The application hierarchy node object. </param> /// <param name="generatorConfiguration"> The generator configuration. </param> /// /// <returns> True if it succeeds, false if it fails. </returns> public bool Process(EntityObject entityObject, EntityPropertyItem entityPropertyItem, Type annotationType, TypeBuilder typeBuilder, AppUIHierarchyNodeObject appHierarchyNodeObject, IGeneratorConfiguration generatorConfiguration) { if (entityPropertyItem.PropertyName == "UIGroup") { foreach (var childProperty in entityPropertyItem.ChildProperties) { var annotationAtrributeType = generatorConfiguration.FindDataAnnotationType(childProperty.PropertyName + "Attribute"); var handler = generatorConfiguration.GetDataAnnotationTypeHandler(childProperty.PropertyName, annotationAtrributeType); if (handler != null) { if (!handler.Process(entityObject, childProperty, annotationAtrributeType, typeBuilder, appHierarchyNodeObject, generatorConfiguration)) { throw new Exception($"Cannot process annotation type '{ annotationAtrributeType.AsDisplayText() }' and property '{ childProperty.PropertyName }"); } } else { throw new HandlerNotFoundException($"Cannot find annotation type handler for annotation type '{ annotationAtrributeType.AsDisplayText() }' and property '{ childProperty.PropertyName }"); } } return(true); } else if (annotationType != null) { return(Process(entityObject, null, entityPropertyItem, appHierarchyNodeObject, annotationType, (c) => typeBuilder.SetCustomAttribute(c))); } else { throw new Exception($"Cannot find Attribute type or custom handler to process property '{ entityPropertyItem.PropertyName }"); } }