This commit is contained in:
Biarity 2018-06-14 18:50:19 +10:00
parent d149721627
commit abb7029c70
3 changed files with 36 additions and 3 deletions

View File

@ -174,6 +174,7 @@ namespace Sieve.Services
filterTerm.Value
};
result = ApplyCustomMethod(result, filterTermName, _customFilterMethods, parameters, dataForCustomMethods);
}
}
if (outerExpression == null)
@ -181,6 +182,10 @@ namespace Sieve.Services
outerExpression = innerExpression;
continue;
}
if (innerExpression == null)
{
continue;
}
outerExpression = Expression.And(outerExpression, innerExpression);
}
return outerExpression == null

View File

@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>2.1.0</Version>
<Version>2.1.2</Version>
<Description>Sieve is a simple, clean, and extensible framework for .NET Core that adds sorting, filtering, and pagination functionality out of the box. Most common use case would be for serving ASP.NET Core GET queries. Documentation available on GitHub: https://github.com/Biarity/Sieve/
</Description>
<Copyright>Copyright 2018</Copyright>
@ -10,7 +10,7 @@
<PackageProjectUrl>https://github.com/Biarity/Sieve</PackageProjectUrl>
<PackageIconUrl>https://emojipedia-us.s3.amazonaws.com/thumbs/240/twitter/120/alembic_2697.png</PackageIconUrl>
<RepositoryUrl></RepositoryUrl>
<PackageReleaseNotes>Fix OR conditions and better SQL Server support</PackageReleaseNotes>
<PackageReleaseNotes>Fix issue #28</PackageReleaseNotes>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Authors>Biarity</Authors>

View File

@ -152,6 +152,34 @@ namespace SieveUnitTests
Assert.IsTrue(result.Count() == 3);
}
[TestMethod]
public void CustomFiltersMixedWithUsualWork1()
{
var model = new SieveModel()
{
Filters = "Isnew,CategoryId==2",
};
var result = _processor.Apply(model, _posts);
Assert.IsTrue(result.Any(p => p.Id == 3));
Assert.IsTrue(result.Count() == 1);
}
[TestMethod]
public void CustomFiltersMixedWithUsualWork2()
{
var model = new SieveModel()
{
Filters = "CategoryId==2,Isnew",
};
var result = _processor.Apply(model, _posts);
Assert.IsTrue(result.Any(p => p.Id == 3));
Assert.IsTrue(result.Count() == 1);
}
[TestMethod]
public void MethodNotFoundExceptionWork()
{