Custom Match Algorithms
Implementing Custom IQueryFilterExtension
public class StringLengthFilter : IQueryFilterExtension
{
/// <summary>
/// Gets the name
/// </summary>
public string Name => "length_difference";
/// <summary>
/// The extension method which is used by Linq
/// </summary>
public MethodInfo ExtensionMethod => typeof(ExtensionMethods).GetMethod(nameof(ExtensionMethods.LengthDifference));
/// <summary>
/// Compose the expression in LINQ
/// </summary>
public BinaryExpression Compose(Expression scope, ExpressionType comparison, Expression valueExpression, Expression[] parms)
{
if (parms.Length != 1) throw new ArgumentOutOfRangeException("difference requires one parameter : value=:(length_difference|other)comparator");
return Expression.MakeBinary(comparison,
Expression.Call(this.ExtensionMethod, scope, parms[0]),
valueExpression);
}
}Implementing Custom IDbFilterFunction
Implementing Custom IDataTransform for Scoring
Last updated
Was this helpful?