public virtual void InitializeComponent(Component component)
 {
     foreach (var propertyInfo in GetContentComponentProperties(component))
     {
         var nestedComponent = GetNestedComponent(component, propertyInfo);
         var contentData     = GetConentAttributeData(propertyInfo);
         var primaryProperty = componentReflectionUtils.GetPrimaryProperty(nestedComponent);
         primaryProperty.SetValue(nestedComponent, contentData);
     }
 }
Esempio n. 2
0
 private void SetResourceValueToComponent(Component component, PropertyInfo propertyInfo, JsonElement jsonElement)
 {
     if (propertyInfo.PropertyType.IsSubclassOf(typeof(Component)))
     {
         var nestedComponent = GetNestedComponent(component, propertyInfo);
         if (jsonElement.ValueKind == JsonValueKind.Object)
         {
             SetResourceValuesToComponent(nestedComponent, jsonElement);
         }
         else
         {
             var primaryProperty = componentReflectionUtils.GetPrimaryProperty(nestedComponent);
             SetPropertyValue(nestedComponent, primaryProperty, jsonElement);
         }
     }
     else
     {
         SetPropertyValue(component, propertyInfo, jsonElement);
     }
 }