public static ConventionBase <IType, IIdExtractor> IdByMethod( this ConventionBuilder <IType, IIdExtractor> source, Func <IMethod, bool> filter, Func <PropertyValueExtractor, PropertyValueExtractor> configurationDelegate ) => source.By(t => configurationDelegate(BuildRoutine.IdExtractor() .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()))) as DelegateBasedConvention <IType, IIdExtractor>;
public static ConventionBase <IType, IIdExtractor> IdByProperty( this ConventionBuilder <IType, IIdExtractor> source, Func <IProperty, bool> filter, Func <PropertyValueExtractor, PropertyValueExtractor> configurationDelegate ) => source .By(t => configurationDelegate(BuildRoutine.IdExtractor().ByPropertyValue(t.Properties.First(filter)))) .When(t => t.Properties.Any(filter));
public static ConventionBase <TFrom, IIdExtractor> Id <TFrom>( this ConventionBuilder <TFrom, IIdExtractor> source, Func <IdExtractorBuilder, IIdExtractor> idExtractorDelegate ) => source.Constant(idExtractorDelegate(BuildRoutine.IdExtractor()));