enisn / AutoFilterer

AutoFilterer is a mini filtering framework library for dotnet. The main purpose of the library is to generate LINQ expressions for Entities over DTOs automatically. The first aim is to be compatible with Open API 3.0 Specifications
MIT License
458 stars 37 forks source link

Provide option to not throw exception when Sort option is not valid #61

Open akamud opened 1 year ago

akamud commented 1 year ago

I would like to just ignore sorting when an invalid sort option in provided. Today two possible exceptions are thrown here and here.

I would like to have an option to opt-out of throwing an exception.

akamud commented 1 year ago

To anyone getting this, right now what I'm doing to workaround this, is to provide a default sorting option by overriding the ApplyOrder in my filter. That way I see what are the possible sorts configured, and if a field that is not in that list is passed, I change the Sort field to be my default value.