This commit is contained in:
Biarity 2019-11-17 09:15:07 +10:00
parent 0dae8c8beb
commit d86e35f77c
15 changed files with 26 additions and 25 deletions

View File

@ -186,7 +186,7 @@ namespace Sieve.Services
{ {
propertyValue = Expression.PropertyOrField(propertyValue, part); propertyValue = Expression.PropertyOrField(propertyValue, part);
} }
if (filterTerm.Values == null) continue; if (filterTerm.Values == null) continue;
foreach (var filterTermValue in filterTerm.Values) foreach (var filterTermValue in filterTerm.Values)

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<Version>2.3.2</Version> <Version>2.3.3</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>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> </Description>
<Copyright>Copyright 2018</Copyright> <Copyright>Copyright 2018</Copyright>
@ -10,7 +10,10 @@
<PackageProjectUrl>https://github.com/Biarity/Sieve</PackageProjectUrl> <PackageProjectUrl>https://github.com/Biarity/Sieve</PackageProjectUrl>
<PackageIconUrl>https://emojipedia-us.s3.amazonaws.com/thumbs/240/twitter/120/alembic_2697.png</PackageIconUrl> <PackageIconUrl>https://emojipedia-us.s3.amazonaws.com/thumbs/240/twitter/120/alembic_2697.png</PackageIconUrl>
<RepositoryUrl></RepositoryUrl> <RepositoryUrl></RepositoryUrl>
<PackageReleaseNotes>Allow subvalues with identical names (#54)</PackageReleaseNotes> <PackageReleaseNotes>Only Skip when pageSize &gt; 0 (#63)
Added support for generic filter and sort methods (#60)
Don't process when filterTerm.Values is null (#59)
</PackageReleaseNotes>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance> <PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Authors>Biarity</Authors> <Authors>Biarity</Authors>

View File

@ -7,7 +7,7 @@ using SieveTests.Entities;
namespace SieveTests.Controllers namespace SieveTests.Controllers
{ {
[Route("api/[controller]/[action]")] [Route("api/[controller]/[action]")]
public class PostsController : Controller public class PostsController : Controller
{ {
private readonly ISieveProcessor _sieveProcessor; private readonly ISieveProcessor _sieveProcessor;

View File

@ -2,7 +2,7 @@
namespace SieveTests.Entities namespace SieveTests.Entities
{ {
public class ApplicationDbContext : DbContext public class ApplicationDbContext : DbContext
{ {
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) { } public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) { }

View File

@ -4,7 +4,7 @@ using Sieve.Attributes;
namespace SieveTests.Entities namespace SieveTests.Entities
{ {
public class Post public class Post
{ {
public int Id { get; set; } public int Id { get; set; }

View File

@ -1,6 +1,5 @@
using Microsoft.EntityFrameworkCore.Migrations; using System;
using System; using Microsoft.EntityFrameworkCore.Migrations;
using System.Collections.Generic;
namespace SieveTests.Migrations namespace SieveTests.Migrations
{ {

View File

@ -5,7 +5,7 @@ using SieveTests.Entities;
namespace SieveTests.Services namespace SieveTests.Services
{ {
public class ApplicationSieveProcessor : SieveProcessor public class ApplicationSieveProcessor : SieveProcessor
{ {
public ApplicationSieveProcessor(IOptions<SieveOptions> options, ISieveCustomSortMethods customSortMethods, ISieveCustomFilterMethods customFilterMethods) : base(options, customSortMethods, customFilterMethods) public ApplicationSieveProcessor(IOptions<SieveOptions> options, ISieveCustomSortMethods customSortMethods, ISieveCustomFilterMethods customFilterMethods) : base(options, customSortMethods, customFilterMethods)
{ {

View File

@ -1,10 +1,10 @@
using Sieve.Services; using System.Linq;
using Sieve.Services;
using SieveTests.Entities; using SieveTests.Entities;
using System.Linq;
namespace SieveTests.Services namespace SieveTests.Services
{ {
public class SieveCustomFilterMethods : ISieveCustomFilterMethods public class SieveCustomFilterMethods : ISieveCustomFilterMethods
{ {
public IQueryable<Post> IsNew(IQueryable<Post> source, string op, string[] values) public IQueryable<Post> IsNew(IQueryable<Post> source, string op, string[] values)
=> source.Where(p => p.LikeCount < 100 && p.CommentCount < 5); => source.Where(p => p.LikeCount < 100 && p.CommentCount < 5);

View File

@ -15,7 +15,7 @@ using SieveTests.Services;
namespace SieveTests namespace SieveTests
{ {
public class Startup public class Startup
{ {
public Startup(IConfiguration configuration) public Startup(IConfiguration configuration)
{ {

View File

@ -3,7 +3,7 @@ using Sieve.Attributes;
namespace SieveUnitTests.Entities namespace SieveUnitTests.Entities
{ {
public class BaseEntity public class BaseEntity
{ {
public int Id { get; set; } public int Id { get; set; }

View File

@ -1,9 +1,8 @@
using System; using Sieve.Attributes;
using Sieve.Attributes;
namespace SieveUnitTests.Entities namespace SieveUnitTests.Entities
{ {
public class Comment : BaseEntity public class Comment : BaseEntity
{ {
[Sieve(CanFilter = true)] [Sieve(CanFilter = true)]
public string Text { get; set; } public string Text { get; set; }

View File

@ -3,7 +3,7 @@ using Sieve.Attributes;
namespace SieveUnitTests.Entities namespace SieveUnitTests.Entities
{ {
public class Post : BaseEntity public class Post : BaseEntity
{ {
[Sieve(CanFilter = true, CanSort = true)] [Sieve(CanFilter = true, CanSort = true)]

View File

@ -351,7 +351,7 @@ namespace SieveUnitTests
Assert.AreEqual(1, resultCount); Assert.AreEqual(1, resultCount);
Assert.AreEqual(3, entry.Id); Assert.AreEqual(3, entry.Id);
} }
[TestMethod] [TestMethod]
public void OrValueFilteringWorks() public void OrValueFilteringWorks()
{ {

View File

@ -1,14 +1,14 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using Sieve.Exceptions;
using Sieve.Models; using Sieve.Models;
using SieveUnitTests.Entities; using SieveUnitTests.Entities;
using SieveUnitTests.Services; using SieveUnitTests.Services;
using System.Linq;
using System.Collections.Generic;
using Sieve.Exceptions;
namespace SieveUnitTests namespace SieveUnitTests
{ {
[TestClass] [TestClass]
public class Mapper public class Mapper
{ {
private readonly ApplicationSieveProcessor _processor; private readonly ApplicationSieveProcessor _processor;

View File

@ -5,7 +5,7 @@ using SieveUnitTests.Entities;
namespace SieveUnitTests.Services namespace SieveUnitTests.Services
{ {
public class ApplicationSieveProcessor : SieveProcessor public class ApplicationSieveProcessor : SieveProcessor
{ {
public ApplicationSieveProcessor( public ApplicationSieveProcessor(
IOptions<SieveOptions> options, IOptions<SieveOptions> options,