コード例 #1
0
ファイル: HtmlConfigExtensions.cs プロジェクト: MiruFx/Miru
 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)));
 }
コード例 #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)));
 }
コード例 #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>());
コード例 #4
0
 public static ElementActionExpression IfPropertyIs <TType, TOrType>(
     this ElementCategoryExpression expression) =>
 expression.If(req =>
               req.Accessor.PropertyType == typeof(TType) || req.Accessor.PropertyType == typeof(TOrType));
コード例 #5
0
 public static ElementActionExpression IfPropertyNameIs(this ElementCategoryExpression expression, string text)
 {
     return(expression.If(m => m.Accessor.Name.Equals(text)));
 }
コード例 #6
0
 public static ElementActionExpression IfPropertyNameEnds(this ElementCategoryExpression expression, string endsWith)
 {
     return(expression.If(m => m.Accessor.Name.EndsWith(endsWith)));
 }