Is there a way to support this kind of scenario with ormlite?
public static class Specific
{
public static readonly List<string> Prefixes = new() { "eywuyw","hftwrw","irete"};
}
public static class StringExtensions
{
public static bool StartsWithSpecificPrefix(this string value)
{
return Specific.Prefixes.Any(value.StartsWith);
}
}
var noOfDeletedEntries =
db.Delete<Entries>(x =>
x.Description.StartsWithSpecificPrefix() &&
x.Start >= dateRange.Start &&
x.Start <= dateRange.End
);
This throws System.NotSupportedException: Specified method is not supported.
In the past I’ve been able to use string extensions with EntityFramework using this project https://github.com/hazzik/DelegateDecompiler
It was pretty useful and looked something like this from what I recall:
using (var ctx = new Entities())
{
var coll = ctx.Entries.Where(x =>
x.Start >= start &&
x.Start <= end &&
x.Description.StartsWithSpecificPrefix()
).Decompile(); //The call to .Decompile(); uses DelegateDecompiler
ctx.Entries.RemoveRange(coll);
ctx.SaveChanges();
}
Is there a way to accomplish this kind of things with OrmLite?
Thanks!