Exemplo n.º 1
0
        public static IConfigureConventions IgnoreMembersOf <T>(this IConfigureConventions conventions) where T : class
        {
            var tp = typeof(T);

            return(conventions.Ignore(m =>
            {
                return tp.GetProperty(m.Name, BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase) != null;
            }));
        }
Exemplo n.º 2
0
 public static IConfigureAction ForModelWithAttribute <T>(this IConfigureConventions conventions)
     where T : Attribute
 {
     return(conventions.If(d => d.PropertyOrParentHasAttribute <T>()));
 }
Exemplo n.º 3
0
 public static IConfigureAction ForType <T>(this IConfigureConventions conventions, bool mustBeProperty = false)
 {
     return(conventions.If(d => d.Type.Is <T>() && (!mustBeProperty?true:MemberRestriction(d, mustBeProperty))));
 }
Exemplo n.º 4
0
 public static IConfigureAction IfNotCustomType(this IConfigureConventions conventions, bool onlyPrimitives = false)
 {
     return(conventions.If(d => !d.Type.IsUserDefinedClass() || (onlyPrimitives || d.HasAttribute <AsOneElementAttribute>())));
 }
Exemplo n.º 5
0
 public static IConfigureAction PropertiesExceptOfType <T>(this IConfigureConventions conventions)
 {
     return(conventions.PropertiesExcept(d => d.PropertyType != typeof(T)));
 }
Exemplo n.º 6
0
 public static IConfigureAction PropertiesExcept(this IConfigureConventions conventions, Func <PropertyInfo, bool> exceptCriteria)
 {
     return(conventions.If(model => !model.IsRootModel && exceptCriteria(model.PropertyDefinition)));
 }
Exemplo n.º 7
0
 public static IConfigureAction PropertiesOnly(this IConfigureConventions conventions)
 {
     return(conventions.If(d => !d.IsRootModel));
 }
Exemplo n.º 8
0
 public static IConfigureAction IfDerivesFrom <T>(this IConfigureConventions conventions, bool mustBeProperty = false)
 {
     return(conventions.If(d => d.Type.DerivesFrom <T>() && !mustBeProperty?true:MemberRestriction(d, mustBeProperty)));
 }
Exemplo n.º 9
0
 public static IConfigureConventions Ignore <T>(this IConfigureConventions conventions)
 {
     return(conventions.Ignore(d => d.Type == typeof(T)));
 }
Exemplo n.º 10
0
 public static IConfigureAction Unless(this IConfigureConventions conventions, Predicate <ModelInfo> predicate)
 {
     return(conventions.If(d => !predicate(d)));
 }