key4.EntityFrameworkCore.Sieve 7.0.4
Sieve
⚗️ 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/
Initialization
- startup
public void ConfigureServices(IServiceCollection services)
{
// Add Sieve service
services.Configure<SieveOptions>(Configuration.GetSection(nameof(SieveOptions)));
services.AddScoped<ISieveProcessor, K4SieveProcessor>();
// Register interceptor, must be the last item
services.AddGrpc(options =>
{
// other interceptors
options.Interceptors.Add<K4GrpcExceptionInterceptor>(); // Exception handling in this order
options.Interceptors.Add<SieveExceptionInterceptor>(); // Exception handling in this order
});
}
- appsettings
{
"SieveOptions": {
"CaseSensitive": false,
"DefaultPageSize": 25,
"MaxPageSize": 100,
"ThrowExceptions": true,
"IgnoreNullsOnNotEqual": true
}
}
- Protobuf definition
message SieveModelRequest {
google.protobuf.StringValue Filters = 1;
google.protobuf.StringValue Sorts = 2;
google.protobuf.Int32Value Page = 3;
google.protobuf.Int32Value PageSize = 4;
}
- Mapping
CreateMap<SieveModelRequest, SieveModel>();
Usage
- Example with count
public async Task<(IEnumerable<queryModel>, int)> GetAll(SieveModel sieveModel)
{
(var query, var count) = _microserviceContext.Organisations.ApplyAndGetTotalCount(sieveModel, _sieveProcessor);
return (_mapper.Map<IEnumerable<queryModel>>(await query.ToListAsync()), count);
}
- Example without count
public async Task<IEnumerable<queryModel>> GetAll(SieveModel sieveModel)
{
var query = _microserviceContext.Organisations.Apply(sieveModel, _sieveProcessor);
return _mapper.Map<IEnumerable<queryModel>>(await query.ToListAsync());
}
- Example with pagination
public async Task<ListResponse<Organisation>> GetAll(SieveModel sieveModel)
{
return _microserviceContext.Organisations.ApplyAndGetPaginationAsync(sieveModel, _sieveProcessor, _mapper);
}
Usage from api call
Operators
| Operator | Meaning |
|---|---|
== |
Equals |
!= |
Not equals |
> |
Greater than |
< |
Less than |
>= |
Greater than or equal to |
<= |
Less than or equal to |
@= |
Contains |
_= |
Starts with |
!@= |
Does not Contains |
!_= |
Does not Starts with |
@=* |
Case-insensitive string Contains |
_=* |
Case-insensitive string Starts with |
==* |
Case-insensitive string Equals |
!=* |
Case-insensitive string Not equals |
!@=* |
Case-insensitive string does not Contains |
!_=* |
Case-insensitive string does not Starts with |
Notes:
- You can use backslashes to escape special characters and sequences:
- commas:
Title@=some\,titlemakes a match with "some,title" - pipes:
Title@=some\|titlemakes a match with "some|title" - null values:
Title@=\nullwill search for items with title equal to "null" (not a missing value, but "null"-string literally)
- commas:
- You can have spaces anywhere except within
{Name}or{Operator}fields
Showing the top 20 packages that depend on key4.EntityFrameworkCore.Sieve.
| Packages | Downloads |
|---|---|
|
key4.Core
Services and classes.
|
18 |
|
key4.Core
Services and classes.
|
22 |
|
key4.Core
Services and classes.
|
24 |
|
key4.Core
Services and classes.
|
28 |
|
key4.Core
Services and classes.
|
33 |
|
key4.Core
Services and classes.
|
40 |
|
key4.Core
Services and classes.
|
43 |
|
key4.Core
Services and classes.
|
56 |
|
key4.Core
Services and classes.
|
61 |
|
key4.EntityFrameworkCore.Sieve.CustomFields
⚗️ 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.
|
24 |
|
key4.EntityFrameworkCore.Sieve.CustomFields
⚗️ 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.
|
30 |
|
key4.EntityFrameworkCore.Sieve.CustomFields
⚗️ 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.
|
45 |
|
key4.MessageQueue.Synchro
Contracts, services and classes used for message queue synchronization of microservices.
|
20 |
|
key4.MessageQueue.Synchro
Contracts, services and classes used for message queue synchronization of microservices.
|
43 |
|
key4.MessageQueue.Synchro
Contracts, services and classes used for message queue synchronization of microservices.
|
72 |
|
key4.MessageQueue.Synchro
Contracts, services and classes used for message queue synchronization of microservices.
|
80 |
|
key4.MessageQueue.Synchro
Contracts, services and classes used for message queue synchronization of microservices.
|
197 |
|
key4.MessageQueue.Synchro
Services and classes used for message queue synchronization of microservices.
|
184 |
|
key4.MessageQueue.Synchro
Services and classes used for message queue synchronization of microservices.
|
219 |
.NET 7.0
- AutoMapper (>= 12.0.1)
- Key4.AspNetCore.HttpExceptions (>= 6.0.0.9-b)
- Microsoft.AspNetCore.Http.Features (>= 5.0.17)
- Microsoft.EntityFrameworkCore (>= 7.0.3)
- Sieve (>= 2.5.5)
| Version | Downloads | Last updated |
|---|---|---|
| 7.0.4 | 26 | 02/15/2023 |
| 7.0.4-a.56 | 13 | 02/16/2023 |
| 7.0.4-a.54 | 11 | 02/15/2023 |
| 7.0.3 | 11 | 02/15/2023 |
| 7.0.3-a.52 | 12 | 02/07/2023 |
| 7.0.3-a.51 | 11 | 02/07/2023 |
| 7.0.2 | 88 | 02/01/2023 |
| 7.0.2-a.50 | 11 | 02/07/2023 |
| 7.0.2-a.48 | 13 | 02/01/2023 |
| 7.0.1 | 20 | 02/01/2023 |
| 7.0.1-a.47 | 10 | 02/01/2023 |
| 7.0.1-a.46 | 10 | 02/01/2023 |
| 7.0.1-a.44 | 15 | 01/30/2023 |
| 7.0.0 | 58 | 01/20/2023 |
| 6.3.0 | 18 | 01/16/2023 |
| 6.3.0-a.39 | 15 | 01/16/2023 |
| 6.2.1 | 94 | 12/19/2022 |
| 6.2.0 | 34 | 12/15/2022 |
| 6.1.0 | 12 | 12/14/2022 |
| 6.0.1 | 15 | 12/08/2022 |
| 6.0.0 | 14 | 12/08/2022 |
| 5.2.0.27-b | 176 | 12/08/2022 |
| 5.2.0.26-b | 11 | 12/08/2022 |
| 5.2.0-a.34 | 11 | 12/12/2022 |
| 5.1.0.25-b | 12 | 12/08/2022 |
| 5.1.0.24-b | 12 | 12/08/2022 |
| 5.1.0.23-b | 11 | 12/08/2022 |
| 5.1.0.22-b | 11 | 12/08/2022 |
| 5.1.0.21-b | 11 | 12/08/2022 |
| 5.0.0.20-b | 12 | 12/08/2022 |
| 4.2.0.19-b | 11 | 12/08/2022 |
| 4.2.0.18-b | 11 | 12/08/2022 |
| 4.2.0.17-b | 11 | 12/08/2022 |
| 4.1.0.16-b | 32 | 12/08/2022 |
| 4.0.0.15-b | 12 | 12/08/2022 |
| 3.4.0.14-b | 13 | 12/08/2022 |
| 3.3.1.13-b | 12 | 12/08/2022 |
| 3.3.0.12-b | 12 | 12/08/2022 |
| 3.2.0.11-b | 13 | 12/08/2022 |
| 3.1.0.10-b | 11 | 12/08/2022 |
| 3.0.0.9-b | 12 | 12/08/2022 |
| 2.0.0.8-b | 10 | 12/08/2022 |
| 1.0.0.7-b | 9 | 12/08/2022 |
| 1.0.0.6-b | 14 | 12/08/2022 |