Beispiel #1
0
 public static ElementActionExpression ForProperty <TModel, TProperty>(
     this ElementCategoryExpression config,
     Expression <Func <TModel, TProperty> > expression)
 {
     return(config.If(m =>
                      m.Accessor.OwnerType == typeof(TModel) &&
                      m.Accessor.PropertyNames.Contains(expression.ToAccessor().Name)));
 }
Beispiel #2
0
 public static ElementActionExpression IfPropertyIsNumber(this ElementCategoryExpression expression)
 {
     return(expression.If(req =>
                          req.Accessor.PropertyType == typeof(int) ||
                          req.Accessor.PropertyType == typeof(long) ||
                          req.Accessor.PropertyType == typeof(decimal) ||
                          req.Accessor.PropertyType == typeof(float)));
 }
Beispiel #3
0
 public static ElementActionExpression IfPropertyTypeAndAttribute <TType, TAttribute>(
     this ElementCategoryExpression expression) where TAttribute : Attribute =>
 expression.If(req => req.Accessor.PropertyType == typeof(TType) && req.Accessor.HasAttribute <TAttribute>());
Beispiel #4
0
 public static ElementActionExpression IfPropertyIs <TType, TOrType>(
     this ElementCategoryExpression expression) =>
 expression.If(req =>
               req.Accessor.PropertyType == typeof(TType) || req.Accessor.PropertyType == typeof(TOrType));
Beispiel #5
0
 public static ElementActionExpression IfPropertyNameIs(this ElementCategoryExpression expression, string text)
 {
     return(expression.If(m => m.Accessor.Name.Equals(text)));
 }
 public static ElementActionExpression IfPropertyNameEnds(this ElementCategoryExpression expression, string endsWith)
 {
     return(expression.If(m => m.Accessor.Name.EndsWith(endsWith)));
 }