public static Type GetLocalizationResourceTypeOrNull(
            this ExtensionPropertyConfiguration property)
        {
            if (property.DisplayName != null &&
                property.DisplayName is LocalizableString localizableString)
            {
                return(localizableString.ResourceType);
            }

            return(null);
        }
        public static string GetLocalizationResourceNameOrNull(
            this ExtensionPropertyConfiguration property)
        {
            var resourceType = property.GetLocalizationResourceTypeOrNull();

            if (resourceType == null)
            {
                return(null);
            }

            return(LocalizationResourceNameAttribute.GetName(resourceType));
        }
        private static void NormalizeProperty(ExtensionPropertyConfiguration propertyInfo)
        {
            if (!propertyInfo.Api.OnGet.IsAvailable)
            {
                propertyInfo.UI.OnTable.IsVisible = false;
            }

            if (!propertyInfo.Api.OnCreate.IsAvailable)
            {
                propertyInfo.UI.OnCreateForm.IsVisible = false;
            }

            if (!propertyInfo.Api.OnUpdate.IsAvailable)
            {
                propertyInfo.UI.OnEditForm.IsVisible = false;
            }
        }
示例#4
0
 public static void ApplyPropertyConfigurationToTypes(
     ExtensionPropertyConfiguration propertyConfig,
     Type[] types)
 {
     ObjectExtensionManager.Instance
     .AddOrUpdateProperty(
         types,
         propertyConfig.Type,
         propertyConfig.Name,
         property =>
     {
         property.Attributes.Clear();
         property.Attributes.AddRange(propertyConfig.Attributes);
         property.DisplayName = propertyConfig.DisplayName;
         property.Validators.AddRange(propertyConfig.Validators);
         property.DefaultValue        = propertyConfig.DefaultValue;
         property.DefaultValueFactory = propertyConfig.DefaultValueFactory;
     }
         );
 }