I'm creating a LINQ extension using LINQKIT, but I can't figure out why I get this error
System.AggregateException: One or more errors occurred (no method 'InGroupsImpl on type 'SLT.Assets.Extensions.LINQExtensions' is compatible with the supplied arguments.)
The number of arguments on the implementing method matches the number of arguments from the extension, as far as I can see.
I can't understand what I'm missing. The extension exposes 3 parameters and the expression method takes 3 values.
Here's my code:
public interface IDbGroups
{
[Required]
string Groups { get; set; }
}
public enum MatchTypes
{
None,
Match,
All
}
public static MatchTypes ListMatches(string list, string values)
{
...
}
[Expandable(nameof(Predicates.InGroupsImpl))]
public static bool DbInGroups(this IDbGroups item, string values)
=> throw new NotSupportedException();
public static Expression<Func<IDbGroups, string, bool>> InGroupsImpl()
=> (item, values) => DbUtility.ListMatches(item.Groups, values) != MatchTypes.None;
Usage:
cache.Settings = await db.GetWorker<Setting>().WhereAsync(s => s.AppId.Equals(cache.App.Id) || s.AppId == null && s.DbInGroups(Setting.DefaultGroupName).Equals(MatchTypes.All));
Type Setting implements IDbGorups
ListMatches.