We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Following situation doesn't work for Country.Name:
Country.Name
public class CityFilterDto : BaseFilterDto { [CompareTo("Name", "Country.Name")] [StringFilterOptions(StringFilterOption.Contains)] public string Filter { get; set; } }
Expected Expression is: .Where(x => x.Name.Contains("Turkey") || x.Country.Name.Contains("Turkey"))
.Where(x => x.Name.Contains("Turkey") || x.Country.Name.Contains("Turkey"))
Generated Expression is .Where(x => x.Name.Contains("Turkey").Where(x.Name.Contains("Turkey")))
.Where(x => x.Name.Contains("Turkey").Where(x.Name.Contains("Turkey")))
The text was updated successfully, but these errors were encountered:
Temporary solution is creating a nested query.
public class CountryFilterDto : FilterBase { [StringFilterOptions(StringFilterOption.Contains)] public string Name { get; set; } }
CityFilterDto
public class CityFilterDto : PaginationFilterBase { [CompareTo("Name")] [StringFilterOptions(StringFilterOption.Contains)] public string Filter { get; set; } public CountryFilterDto Country { get; set; } }
public class CityFilterDto : PaginationFilterBase { private string filter; [CompareTo("Name")] [StringFilterOptions(StringFilterOption.Contains)] public string Filter { get => filter; set => SetFilter(value); } public CountryFilterDto Country { get; set; } private void SetFilter(string value) { filter = value; // keep backing field. if(Country == null) Country = new CountryFilterDto(); Country.Name = value; this.CombineWith = CombineType.Or; // Make sure combines with || instead of && } }
That's it! Nested query will work properly. This solution is temporary until solution of this issue.
Sorry, something went wrong.
enisn
No branches or pull requests
Following situation doesn't work for
Country.Name
:Expected Expression is:
.Where(x => x.Name.Contains("Turkey") || x.Country.Name.Contains("Turkey"))
Generated Expression is
.Where(x => x.Name.Contains("Turkey").Where(x.Name.Contains("Turkey")))
The text was updated successfully, but these errors were encountered: