private static void HandleNavigationProperty(PropertyInfo propertyInfo, ICollection <GridTypePropertyModel> propertyModels) { foreach (var property in propertyInfo.PropertyType.GetProperties()) { var gridTypeProperty = new GridTypePropertyModel($"{propertyInfo.Name}.{property.Name}", property.PropertyType) { HasSummaryCalculationSupport = property.PropertyType.IsNumericType() }; ApplyGridPropertyAttributeIfExist(property, gridTypeProperty); propertyModels.Add(gridTypeProperty); } }
private static void AddGridTypeProperty(Type type, PropertyInfo property, List <GridTypePropertyModel> gridTypeProperties) { if (!(property.PropertyType.IsClass && property.PropertyType.Assembly.FullName == type.Assembly.FullName)) { var gridTypeProperty = new GridTypePropertyModel(property.Name, property.PropertyType) { HasSummaryCalculationSupport = property.PropertyType.IsNumericType() }; ApplyGridPropertyAttributeIfExist(property, gridTypeProperty); gridTypeProperties.Add(gridTypeProperty); } else { HandleNavigationProperty(property, gridTypeProperties); } }
private static void ApplyGridPropertyAttributeIfExist(PropertyInfo propertyInfo, GridTypePropertyModel propertyModel) { GridPropertyAttribute gridParameterAttribute = propertyInfo.GetCustomAttribute <GridPropertyAttribute>(); if (gridParameterAttribute == null) { return; } propertyModel.ApplyGridPropertyAttribute(gridParameterAttribute); }