QBQueryBuilder 1.3.8

dotnet add package QBQueryBuilder --version 1.3.8
NuGet\Install-Package QBQueryBuilder -Version 1.3.8
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="QBQueryBuilder" Version="1.3.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add QBQueryBuilder --version 1.3.8
#r "nuget: QBQueryBuilder, 1.3.8"
#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 QBQueryBuilder as a Cake Addin
#addin nuget:?package=QBQueryBuilder&version=1.3.8

// Install QBQueryBuilder as a Cake Tool
#tool nuget:?package=QBQueryBuilder&version=1.3.8

Query Builder

Package Manager

Install-Package QBQueryBuilder -Version 1.3.8

.NET CLI

dotnet add package QBQueryBuilder --version 1.3.8

Package Manager

<PackageReference Include="QBQueryBuilder" Version="1.3.8" />

Why use this?

If you want to set up a search route and it will search/query the same fields for the next 2 years, you don't have to write a bunch of code, just put QBField attributes on your entity, provide a search term and some page options and that is it. And if you need to change the logic from a filter like StartsWith to Equals it is really easy to do that because it is an enum and it is right there in your code.

If you have an object with 10 different properties and you want to search/query 10 fields on an entity, you can write less code than you need to (for complex logic you might need to write more code)

If you wrote your logic and just want to paginate, call the QBPaginate method and then QBResult method after that, or apply your own logic for getting the results after you call QBPaginate

If you just want to filter or sort, use the QBFilter or QBSort method

Supports

  • Filtering
  • Sorting
  • Paginating

Simple Use

var options = new QBOptions()
{
    FilterOptions = new QBFilterOptions()
    {
        Fields = new List<QBFieldOptions>()
        {
            new QBFieldOptions("FieldName", "Keyword", QBFilter.StartsWith, QBOperator.Or, QBMethod.ToLower, queryNulls(true/false)),
            new QBFieldOptions("FieldName", new int[] { 1, 2, 3 }, QBFilter.Contains)
        }
    },
    SortOptions = new QBSortOptions()
    {
        Fields = new List<QBSortFieldOptions>()
        {
            new QBSortFieldOptions("FieldName", QBSort.Descending)
        }

    },
    PageOptions = new QBPageOptions(pageSize, pageNumber)
};


QBResult result = await _context.MyEntities.QBBuildQueryAsync(options);
QBResult result = _context.MyEntities.QBBuildQuery(options);

Simple Use Entity Attributes

public class MyEntity
{
    [QBField(QBFilter.Equals, queryNulls = false)]
    [QBSortField(QBSort.Ascending)]
    public int MyEntityId { get; set; }

    [QBField(QBFilter.StartsWith, QBOperator.And)]
    [QBField(QBFilter.EndsWith, QBOperator.And)]
    public string Name { get; set; }

    [QBSortField(QBSort.Descending)]
    public DateTime CreatedOn { get; set; }
}


QBResult result = await _context.MyEntities.QBBuildQueryAsync(keyword, pageSize, pageNumber);
QBResult result = _context.MyEntities.QBBuildQuery(keyword, pageSize, pageNumber);

Advanced Use

var result = await _context.MyEntities.QBFilterAsync(options).ToListAsync();
var result = _context.MyEntities.QBFilter(options).ToList();

var result = await _context.MyEntities.QBSortAsync(options).ToListAsync();
var result = _context.MyEntities.QBSort(options).ToList();

QBQuery query = await _context.MyEntities.OrderBy(x => x).QBPaginateAsync(options);
QBQuery query = _context.MyEntities.OrderBy(x => x).QBPaginate(options);

QBResult result = await query.QBResultAsync();
QBResult result = query.QBResult();

QBOptions

new QBOptions()
{
    FilterOptions = new QBFilterOptions() { },
    SortOptions = new QBSortOptions() { },
    PageOptions = new QBPageOptions() { }
}

QBFilterOptions

new QBFilterOptions()
{
    Fields = new List<QBFieldOptions>()
    {
        new QBFieldOptions("MyField", "Keyword", QBFilter, QBOperator, QBMethod)
    }
}

Keyword

Supported Types

  • String, String[]
  • Char, Char[]
  • DateTime, DateTime[]
  • Int16, Int16[]
  • UInt16, UInt16[]
  • Int32, Int32[]
  • UInt32, UInt32[]
  • Int64, Int64[]
  • UInt64, UInt64[]
  • Double, Double[]
  • Decimal, Decimal[]
  • Single, Single[]
  • Byte, Byte[]
  • SByte, SByte[]
  • Boolean, Boolean[]
  • Guid, Guid[]

Field

Supported Fields

  • "MyField"
  • "MyField.MyNestedField"
  • "MyField.MyNestedField.MyNestedField" and so on

NOTE: Field or Nested Field cannot be an array

QBSortOptions

new QBSortOptions()
{
    Fields = new List<QBSortFieldOptions>()
    {
        new QBSortFieldOptions("Field", QBSort)
    }
}

QBPageOptions

new QBPageOptions(pageSize, pageNumber)

QBFilter

  • Contains, ⇐ Default
  • NotContains,
  • Equals,
  • NotEquals,
  • StartsWith,
  • NotStartsWith,
  • EndsWith,
  • NotEndsWith,
  • GreaterThan,
  • NotGreaterThan,
  • GreaterThanOrEqualTo,
  • NotGreaterThanOrEqualTo,
  • LessThan,
  • NotLessThan,
  • LessThanOrEqualTo,
  • NotLessThanOrEqualTo

QBMethod

  • None ⇐ Default
  • ToUpper
  • ToLower

QBSort

  • Ascending ⇐ Default
  • Descending

QBOperator

  • Or ⇐ Default
  • And
Product 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 was computed. 
.NET Framework net46 is compatible.  net461 is compatible.  net462 is compatible.  net463 was computed.  net47 is compatible.  net471 is compatible.  net472 is compatible.  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. 
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.3.8 647 5/20/2019

Version (1.3.8) => Added support for nullable fields, Fixed a bug where an array was being casted to an object[] but not to the correct type[] like string[] or int[], etc, Supports .NET Frameworks(4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2) .NET Standard(2.0)