SmartOrderBy 1.1.0.3
See the version list below for details.
dotnet add package SmartOrderBy --version 1.1.0.3
NuGet\Install-Package SmartOrderBy -Version 1.1.0.3
<PackageReference Include="SmartOrderBy" Version="1.1.0.3" />
paket add SmartOrderBy --version 1.1.0.3
#r "nuget: SmartOrderBy, 1.1.0.3"
// Install SmartOrderBy as a Cake Addin #addin nuget:?package=SmartOrderBy&version=1.1.0.3 // Install SmartOrderBy as a Cake Tool #tool nuget:?package=SmartOrderBy&version=1.1.0.3
SmartOrderBy
It intelligently sorts a sequence of items in a simple and practical way.
SmartOrderBy is a method that aims to make the Queryable.OrderBy
method smarter and is based on the foundations of .NET.
I would be very happy if you could star β the project.
Quick Start
The usage of SmartOrderBy is quite simple.
- Install
SmartOrderBy
NuGet package from here.
PM> Install-Package SmartOrderBy
- We add our Sorting object to our Request object.
public Sorting OrderBy { get; set; }
The structure of the Sorting object;
public class Sorting
{
public string Name { get; set; }
public string OrderType { get; set; }
}
Name
β The name of the field to be sorted.
OrderType
β The type of the order.
It can be specified as "asc", "ascending", "a" or "desc", "descending", "d".
- And we sort intelligently. And that's it.
[HttpPost("/publishers")]
public IActionResult GetPublishers(PublisherRequest request)
{
var result = _context.Publishers
.Include(x => x.Books)
.ThenInclude(x => x.Author)
.OrderBy(request.OrderBy)
.ToList();
return Ok(result);
}
Details
If you want to specify the name of the field you want to sort differently from the field in the entity, you need to map it.
π You can access the sample domain structure here. π
For example, if you want to make a sorting with the name bookId
according to the Id field of the Book
entity in Publisher
, you will need to make a mapping as follows.
OrderByMapper.Map<Publisher, Book>("bookId", x => x.Id);
Or if you want to make a sort with the authorAge
name according to the Age field of the Author
entity in the Book entity in Publisher
;
OrderByMapper.Map<Publisher, Book, Author>("authorAge", x => x.Age);
β The important thing here is to specify the relevant entities in Map<TSource,T1,T2,...> respectively until you reach the sort field.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SmartOrderBy:
Package | Downloads |
---|---|
EntityGuardian
In your projects developed with EntityFramework, it keeps track of all the changes that take place in your database and records them wherever you want. |
GitHub repositories
This package is not used by any popular GitHub repositories.