Пример #1
0
 public static ConventionBase <IType, IValueExtractor> ValueByMethod(
     this ConventionBuilder <IType, IValueExtractor> source, Func <IMethod, bool> filter,
     Func <PropertyValueExtractor, PropertyValueExtractor> configurationDelegate
     ) => source
 .By(t => configurationDelegate(BuildRoutine.ValueExtractor()
                                .ByPropertyValue(new MethodAsProperty(
                                                     t.Methods.First(filter.And(o => o.HasNoParameters() && !o.ReturnsVoid()))
                                                     ))
                                ))
 .When(t => t.Methods.Any(filter.And(o => o.HasNoParameters() && !o.ReturnsVoid())));
Пример #2
0
 public static ConventionBase <IType, IValueExtractor> ValueByProperty(
     this ConventionBuilder <IType, IValueExtractor> source, Func <IProperty, bool> filter,
     Func <PropertyValueExtractor, PropertyValueExtractor> configurationDelegate
     ) => source
 .By(t => configurationDelegate(BuildRoutine.ValueExtractor().ByPropertyValue(t.Properties.First(filter))))
 .When(t => t.Properties.Any(filter));
Пример #3
0
 public static ConventionBase <TFrom, IValueExtractor> Value <TFrom>(
     this ConventionBuilder <TFrom, IValueExtractor> source,
     Func <ValueExtractorBuilder, IValueExtractor> valueExtractorDelegate
     ) => source.Constant(valueExtractorDelegate(BuildRoutine.ValueExtractor()));