Panner.AspNetCore 3.0.0

dotnet add package Panner.AspNetCore --version 3.0.0                
NuGet\Install-Package Panner.AspNetCore -Version 3.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Panner.AspNetCore" Version="3.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Panner.AspNetCore --version 3.0.0                
#r "nuget: Panner.AspNetCore, 3.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Panner.AspNetCore as a Cake Addin
#addin nuget:?package=Panner.AspNetCore&version=3.0.0

// Install Panner.AspNetCore as a Cake Tool
#tool nuget:?package=Panner.AspNetCore&version=3.0.0                

Sorting and filtering made easy for your ASP.NET Core project! From CSV input to a filtered/sorted IQueryable with no effort using Panner, with some extra shortcuts.

For more options, see Panner's documentation.

Usage

// Your action method!
[HttpGet]
// Sample request: /entities?sorts=CreatedTimeStamp,Id&filters=Name=Foo||Name=Bar,IsVisible=True
public async Task<IActionResult> GetAllPosts(
	[FromServices] DbContext myDbContext,

	// Add the following parameters to parse/validate csv inputs into particles.
	// Custom model binders take care of converting the csv string into a collection of particles.
	[FromQuery] IReadOnlyCollection<ISortParticle<MyEntity>> sorts,
	[FromQuery] IReadOnlyCollection<IFilterParticle<MyEntity>> filters
)
{
	var result = await myDbContext.MyEntity
			.Apply(filters)	// Apply validated and parsed filters
			.Apply(sorts)	// Apply validated and parsed sorts
			.ToArrayAsync();

	return Ok(result);
}

Setup

// Startup.cs
public void ConfigureServices(IServiceCollection services)
{

	services.AddMvc(); // Or maybe you're using .AddControllers()!

	services.UsePanner(c =>
	{
		// Entity wide configuration (Option 1)
		c.Entity<Post>()
		    .AllPropertiesAreSortableByName();
		    .AllPropertiesAreFilterableByName();

		// A more granular approach (Option 2)
		c.Entity<MyEntity>()
			.Property(x => x.Id, o => o
				.IsSortableAs(nameof(Views.Post.Id))
				.IsFilterableAs(nameof(Views.Post.Id))
			)
			.Property(x => x.Title, o => o
				.IsSortableAs(nameof(Views.Post.Title))
			)
			.Property(x => x.CreatedOn, o => o
				.IsSortableAs(nameof(Views.Post.Creation))
				.IsFilterableAs(nameof(Views.Post.Creation))
			);
	});
}
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.0 412 10/12/2021
2.1.2 501 6/2/2020
2.1.1 535 12/11/2019
2.0.0 513 12/6/2019