Beispiel #1
0
        private void AddLookupTextProperty(ExtensionPropertyConfiguration propertyInfo)
        {
            var lookupTextPropertyName = $"{propertyInfo.Name}_Text";
            var lookupTextPropertyInfo = Properties.GetOrAdd(
                lookupTextPropertyName,
                () => new ExtensionPropertyConfiguration(this, typeof(string), lookupTextPropertyName)
                );

            lookupTextPropertyInfo.DisplayName = propertyInfo.DisplayName ?? new FixedLocalizableString(propertyInfo.Name);
        }
Beispiel #2
0
        public static Type GetLocalizationResourceTypeOrNull(
            this ExtensionPropertyConfiguration property)
        {
            if (property.DisplayName != null &&
                property.DisplayName is LocalizableString localizableString)
            {
                return(localizableString.ResourceType);
            }

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

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

            return(LocalizationResourceNameAttribute.GetName(resourceType));
        }
 public static void ApplyPropertyConfigurationToTypes(
     ExtensionPropertyConfiguration propertyConfig,
     Type[] types)
 {
     ObjectExtensionManager.Instance
     .AddOrUpdateProperty(
         types,
         propertyConfig.Type,
         propertyConfig.Name,
         property =>
     {
         property.Attributes.AddRange(propertyConfig.Attributes);
         property.DisplayName = propertyConfig.DisplayName;
         property.Validators.AddRange(propertyConfig.Validators);
     }
         );
 }
Beispiel #5
0
        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;
            }
        }
 public static void ApplyPropertyConfigurationToTypes(
     ExtensionPropertyConfiguration propertyConfig,
     Type[] types)
 {
     lock (SyncLock)
     {
         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;
             property.Lookup = propertyConfig.UI.Lookup;
         }
             );
     }
 }