Sondor.Queries 1.0.2

dotnet add package Sondor.Queries --version 1.0.2
                    
NuGet\Install-Package Sondor.Queries -Version 1.0.2
                    
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="Sondor.Queries" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sondor.Queries" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Sondor.Queries" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Sondor.Queries --version 1.0.2
                    
#r "nuget: Sondor.Queries, 1.0.2"
                    
#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.
#:package Sondor.Queries@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Sondor.Queries&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Sondor.Queries&version=1.0.2
                    
Install as a Cake Tool

Sondor Queries

The Sondor Queries package provides various types that come with many extensions, helpers and integrations for a simple and smooth experience with implementing complex queried logic.

Contents

  1. Getting started
  2. Supported languages
  3. Error codes
  4. Testing
  5. Query Attributes
  6. Query Types

Getting started

To get started with the Sondor.Queries package, follow these steps:

  1. First, install the Sondor.Queries NuGet package.
  2. Next, register using builder.Services.AddSondorQueries().
  3. Finally, you'll have access to the various Query Types.

Support languages

Language Supported Language code
Arabic Yes ar
Bulgarian Yes bg
Czech Yes cs
Danish Yes da
German Yes de
Greek Yes el
English Yes en
Spanish Yes es
Estonian Yes et
Finnish Yes fi
Filipino Yes fil
French Yes fr
Irish Yes ga
Hindi Yes hi
Croatian Yes hr
Hungarian Yes hu
Italian Yes it
Japanese Yes ja
Korean Yes ko
Lithuanian Yes lt
Latvian Yes lv
Maltese Yes mt
Dutch Yes nl
Polish Yes pl
Portuguese Yes pt
Romanian Yes ro
Russian Yes ru
Slovak Yes sk
Slovenian Yes sl
Swedish Yes sv
Vietnamese Yes vi
Chinese (Simplified) Yes zh

Error codes

Error code Error Description
2000 Invalid sort The invalid sort error.
2001 Invalid sort property The invalid sort property error.
2002 Invalid sort query The invalid sort query error.
2003 Invalid search property The invalid search property error.
2004 Invalid search query The invalid search query error.
2005 Invalid field The invalid field error.
2006 Invalid fields query The invalid fields query error.
2007 Invalid patch The invalid patch error.
2008 Invalid patch property The invalid patch property error.
2009 Invalid patch query The invalid patch query error.
2010 Invalid filter The invalid filter error.
2011 Invalid filter operator The invalid filter operator error.
2012 Invalid filter property The invalid filter property error.
2013 Invalid filter value The invalid filter value error.

Testing

Testing is important in software as it ensures quality and minimises the risk of bugs reaching production. To simplify the developer experience when working with Sondor.Queries we've created the SondorQueriesAssert class which provides helpers to simplify the process of testing logic using the Sondor.Queries package.

AssertSort

The AssertSort helps test the Sort type. We provide a helper function, enabling one line to assert that the received Sort matches the expected Sort.

SondorQueriesAssert.AssertSort(sort, expected);
AssertSorts

The AssertSorts helps test a collection of Sort errors. To ensure consistency when comparing the two arrays of Sort's provided. The assert defaults to normalizing the order by ordering the sorts by Property and then by Ascending. This can be overridden by explicitly providing false to normalizeOrder when using.

SondorQueriesAssert.AssertSorts(sorts, expected, normalizeOrder);
AssertSortQuery

The AssertSortQuery helps test the SortQuery type. We provide a helper function, enabling one line to assert that the received SortQuery matches the expected SortQuery.

SondorQueriesAssert.AssertSortQuery(sortQuery, expected);
AssertField

The AssertField helps test the FieldsQuery type. We provide a helper function, enabling one line to assert that the received FieldsQuery matches the expected FieldsQuery.

SondorQueriesAssert.AssertField(fieldsQuery, expected);
AssertSearch

The AssertSearch helps test the SearchQuery type. We provide a helper function, enabling one line to assert that the received SearchQuery matches the expected SearchQuery.

SondorQueriesAssert.AssertSearch(searchQuery, expected);
AssertFilter

The AssertFilter helps test the Filter type. We provide a helper function, enabling one line to assert that the received Filter matches the expected Filter.

SondorQueriesAssert.AssertFilter(filter, expected);
AssertPatch

The AssertPatch helps test the Patch type. We provide a helper function, enabling one line to assert that the received Patch matches the expected Patch.

SondorQueriesAssert.AssertPatch(patch, expected);
AssertPatch

The AssertPatch helps test the Patch type. We provide a helper function, enabling one line to assert that the received Patch matches the expected Patch.

SondorQueriesAssert.AssertPatch(patch, expected);
AssertPatches

The AssertPatches helps test a collection of Patch errors. Ensure consistency when comparing the two arrays of Patch provided. The assert defaults to normalizing the order by ordering the sorts by Property and then by Value. This can be overridden by explicitly providing false to normalizeOrder when using.

SondorQueriesAssert.AssertPatches(patches, expected, normalizeOrder);
AssertPatchQuery

The AssertPatchQuery helps test the PatchQuery type. We provide a helper function, enabling one line to assert that the received PatchQuery matches the expected PatchQuery.

SondorQueriesAssert.AssertPatchQuery(patchQuery, expected);

Query Types

Throughout Sondor software, we provide a range of complex querying functionality. To improve the developer experience, we created the Sondor.Queries package which provides various custom types, extensions, and more to be able to easily add these complex features with ease and minimise the risk of bugs and variation across the business.

Query Attributes

To get started with Sondor.Queries, you'll need to use various custom attributes that are provided. Each attribute provides integration to various querying functionality automatically.

Attributes
  1. SondorFieldAttribute
  2. SondorFilterableAttribute
  3. SondorPatchableAttribute
  4. SondorSearchableAttribute
  5. SondorSortableAttribute
SondorFieldAttribute

The field attribute decorates a property with querying metadata that is required to integrate with any of the querying functionality.

Property Description
Keys The keys property decorates a property with an array of keys that can be used to identify the property.
IsDefault The IsDefault property marks the property as a default field, for retrieving default fields for a type.
UsePropertyName The UsePropertyName property determines, whether to include the property name with the keys as acceptable field names.
OverrideProperty The `OverrideProperty is used to override the property name returned when retrieving the name of a property when searching via a field key. This is useful when mapping between multiple models and the property names differ.
SondorFilterableAttribute

The filterable attribute labels a property as being Filterable. This means, that when a filter query is made, the property can be explicitly provided as one of the target properties for the filter.

SondorPatchableAttribute

The patchable attribute labels a property as being Patchable. This means, that the property of an instance of the type can be modified in isolation without having to completely update the entire instance.

SondorSearchableAttribute

The searchable attribute labels a property as being Searchable. This means, that when a search query is made, the property can either be explicitly provided as the target property for the search or will be included when searching against all searchable properties for a type.

SondorSortableAttribute

The sortable attribute labels a property as being Sortable. This means, that when a sort query is made, the property can either be provided as a sorting target.

Property Description
IsDefault The IsDefault property marks the property as a default sort field, for retrieving the default sort properties for a type.
DefaultOrder The DefaultOrder specifies the order the property should be in when retrieving the default sort properties.
DefaultAscending The DefaultAscending specifies in the property, when retrieved as a default sort query for a type, the property is sorted in either Ascending or Descending order.

Types

  1. Fields Query
  2. Filter Query
  3. Patch Query
  4. Search Query
  5. Sort Query

Fields Query

The FieldsQuery type is used to normalise the format provided when explicitly specifying fields of interest, to optimise performance and only request data that is needed thus improving payload size. Specify a type field name(s) for properties by using the SondorFieldAttribute.

Format

The fields query format is simply a comma-separated list of property names.

Example: id,name,created

Methods
Method Description Example
FromQuery The FromQuery method creates an instance of FieldsQuery from a provided string. FromQuery
GetDefault<TType> The GetDefault<TType> method constructs an instance of FieldsQuery using the default fields for the provided TType. GetDefault
All The All instance of FieldsQuery is a static instance, that uses the * wild card which identifies all field properties. FieldsQuery.All
ValidateFields<TType> The ValidateFields validates the properties in the provided FieldsQuery against the provided TType. ValidateFields
FieldsQuery FromQuery
FieldsQuery.FromQuery("id,name,active,created");
FieldsQuery GetDefault
FieldsQuery.GetDefault<TestClass>();
FieldsQuery ValidateFields
typeof(TestClass).ValidateFields(fieldsQuery);
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
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
1.0.2 104 8/17/2025
1.0.1 126 8/11/2025
1.0.0 118 7/31/2025
1.0.0-1-resolve-pipeline.3 95 7/31/2025

The initial release.