Exemplo n.º 1
0
 public static void SetDefaultValues(this DynamicModelPropertyInfo info, Dictionary <string, object> propertyNames)
 {
     if (propertyNames.ContainsKey(info.Name))
     {
         info.RemoveAttributes(typeof(DefaultValueAttribute));
         info.AddAttribute(new DefaultValueAttribute(propertyNames[info.Name]));
     }
 }
Exemplo n.º 2
0
 public static void SetCategory(this DynamicModelPropertyInfo info, Dictionary <string, string> propertyNames)
 {
     if (propertyNames.ContainsKey(info.Name))
     {
         info.RemoveAttributes(typeof(BrowsableAttribute));
         info.AddAttribute(new CategoryAttribute(propertyNames[info.Name]));
     }
 }
Exemplo n.º 3
0
        public static void CreateValueCalculator(this DynamicModelPropertyInfo info, string expressionPath = null)
        {
            info.AddAttribute(new BrowsableAttribute(false));
//            return;
//            CreateValueCalculatorCore(info);
//            ModelValueCalculatorAttribute modelValueCalculatorAttribute;
//            if (expressionPath != null) {
//                modelValueCalculatorAttribute = new ModelValueCalculatorAttribute(expressionPath);
//                info.AddAttribute(new ModelValueCalculatorWrapperAttribute(modelValueCalculatorAttribute, null));
//            } else {
//                info.RemoveAttributes(typeof(ReadOnlyAttribute));
//                var type = typeof(MapModelValueCalculator);
//                modelValueCalculatorAttribute = new ModelValueCalculatorAttribute(type);
//                info.AddAttribute(new ModelValueCalculatorWrapperAttribute(modelValueCalculatorAttribute, type));
//                info.AddAttribute(new ModelReadOnlyAttribute(typeof(MapModelReadOnlyCalculator)));
//            }
        }
Exemplo n.º 4
0
 static void CreateValueCalculatorCore(DynamicModelPropertyInfo info)
 {
     info.RemoveAttributes(typeof(DefaultValueAttribute));
     info.AddAttribute(new ReadOnlyAttribute(true));
 }
Exemplo n.º 5
0
 public static void CreateValueCalculator(this DynamicModelPropertyInfo info, IModelValueCalculator modelValueCalculator)
 {
     CreateValueCalculatorCore(info);
     info.AddAttribute(new ModelValueCalculatorWrapperAttribute(modelValueCalculator.GetType()));
 }