public TagProfileExpression(TagProfile profile)
 {
     _profile = profile;
     Labels = new TagFactoryExpression(profile.Label);
     Editors = new TagFactoryExpression(profile.Editor);
     Displays = new TagFactoryExpression(profile.Display);
 }
 public TagProfileExpression()
 {
     Profile  = new TagProfile("default");
     Labels   = new TagFactoryExpression(Profile.Label);
     Editors  = new TagFactoryExpression(Profile.Editor);
     Displays = new TagFactoryExpression(Profile.Display);
 }
 public TagProfileExpression()
 {
     Profile = new TagProfile("default");
     Labels = new TagFactoryExpression(Profile.Label);
     Editors = new TagFactoryExpression(Profile.Editor);
     Displays = new TagFactoryExpression(Profile.Display);
 }
Beispiel #4
0
 public static TagActionExpression IfPropertyTypeIsNullableEnum(this TagFactoryExpression expression)
 {
     return(expression.If(f =>
     {
         var propertyType = f.Accessor.InnerProperty.PropertyType;
         return propertyType.IsGenericType &&
         propertyType.GetGenericTypeDefinition() == typeof(Nullable <>) &&
         new NullableConverter(propertyType).UnderlyingType.IsEnum;
     }));
 }
        public TagProfileExpression(TagProfile profile)
        {
            _profile = profile;
            Labels = new TagFactoryExpression(profile.Label);
            Editors = new TagFactoryExpression(profile.Editor);
            Displays = new TagFactoryExpression(profile.Display);

            BeforePartial = new TagFactoryExpression(profile.BeforePartial);
            AfterPartial = new TagFactoryExpression(profile.AfterPartial);
            BeforeEachOfPartial = new PartialTagFactoryExpression(profile.BeforeEachOfPartial);
            AfterEachOfPartial = new PartialTagFactoryExpression(profile.AfterEachOfPartial);
        }
        public static TagFactoryExpression ModifyForRule<TRule>(this TagFactoryExpression tags, Action<TRule, ElementRequest, HtmlTag> continuation)
            where TRule : IFieldValidationRule
        {
            tags
                .Always
                .Modify((request, tag) =>
                            {
                                var registry = request.Get<IFieldRulesRegistry>();
                                registry.ForRule<TRule>(request.Accessor, rule => continuation(rule, request, tag));
                            });

            return tags;
        }
 public static TagFactoryExpression ModifyForRule<TRule>(this TagFactoryExpression tags, Action<TRule, HtmlTag> continuation)
     where TRule : IFieldValidationRule
 {
     return tags.ModifyForRule<TRule>((rule, request, tag) => continuation(rule, tag));
 }
Beispiel #8
0
 public static TagActionExpression IfPropertyTypeIsEnum(this TagFactoryExpression expression)
 {
     return(expression.IfPropertyTypeIs(t => t.IsEnum));
 }
Beispiel #9
0
 public static TagActionExpression IfPropertyIs <T1, T2>(this TagFactoryExpression expression)
 {
     return(expression.If(req => req.Accessor.PropertyType == typeof(T1) || req.Accessor.PropertyType == typeof(T2)));
 }
Beispiel #10
0
 public static TagActionExpression IfPropertyHasAttribute <T>(this TagFactoryExpression expression) where T : Attribute
 {
     return(expression.If(req => req.Accessor.HasAttribute <T>()));
 }