Open
Description
After some researching, I found the problem - missing try/catch block in the ApplyFiltering method. This block exist in the Apply method, because of it when we pass a filter that doesn't exist in a model and doesn't exist in custom filters, we got exception SieveMethodNotFoundException in the ApplyCustomMethod method.
Because of it when we pass any not exist filter, the Sieve will ignore all filters and sorts, because it will be finished applying in catch block.
public IQueryable<TEntity> Apply<TEntity>(
TSieveModel model,
IQueryable<TEntity> source,
object[] dataForCustomMethods = null,
bool applyFiltering = true,
bool applySorting = true,
bool applyPagination = true)
{
IQueryable<TEntity> result = source;
if ((object) model == null)
return result;
try
{
if (applyFiltering)
result = this.ApplyFiltering<TEntity>(model, result, dataForCustomMethods);
if (applySorting)
result = this.ApplySorting<TEntity>(model, result, dataForCustomMethods);
if (applyPagination)
result = this.ApplyPagination<TEntity>(model, result);
return result;
}
catch (Exception ex)
{
if (!this.Options.Value.ThrowExceptions)
return result;
if (!(ex is SieveException))
throw new SieveException(ex.Message, ex);
throw;
}
}
Metadata
Assignees
Labels
No labels
Activity