Skip to content

Introduction

Greetings!

Gridify is a dynamic LINQ library designed to simplify the process of converting strings into LINQ queries. It offers remarkable performance and ease-of-use, making it effortless to apply filtering, sorting, and pagination utilizing text-based data.

Features

Here are some notable features of Gridify:

  • Fast and user-friendly
  • Supports filtering, sorting, and pagination
  • Enables conversion from strings to LINQ queries
  • Supports nested queries and sub-collections
  • Allows mapping from strings to objects
  • Supports query compilation
  • Supports DocumentDBs
  • Compatible with collection indexes
  • Custom operators
  • Can be used with any collection that supports LINQ
  • Compatible with object-mappers like AutoMapper
  • Compatible with ORMs, particularly Entity Framework
  • Supports Elasticsearch DSL query
  • Javascript/Typescript gridify-client

Examples

To provide a better understanding of Gridify's functionality, we have prepared a few examples:

Performance

Filtering remains the most expensive operation in Gridify.

In .NET 8, Gridify was slightly faster than native LINQ, but with .NET 10 improvements to LINQ itself, native performance has caught up.

The latest benchmark shows Gridify performing nearly identically to native LINQ, while still clearly ahead of other dynamic LINQ libraries.

Pagination and sorting continue to have minimal performance impact.

MethodMeanErrorStdDevRatioRatioSDAllocatedAlloc Ratio
Native_LINQ1.049 ms0.0047 ms0.0041 ms1.000.0132.02 KB1.00
Gridify1.079 ms0.0071 ms0.0066 ms1.030.0134.76 KB1.09
Gridify_WithoutMapper1.090 ms0.0074 ms0.0069 ms1.040.0140.37 KB1.26
Sieve1.216 ms0.0103 ms0.0097 ms1.160.0144.21 KB1.38
DynamicLinq1.284 ms0.0088 ms0.0082 ms1.220.0192.42 KB2.89
Fop4.749 ms0.0445 ms0.0416 ms4.530.04284.77 KB8.89
CSharp_Scripting224.708 ms4.4534 ms7.5621 ms214.247.1723303.11 KB727.67
Details
BenchmarkDotNet v0.15.6, Windows 11 (10.0.26200.7171)
AMD Ryzen 7 7800X3D 4.20GHz, 1 CPU, 8 logical and 8 physical cores
.NET SDK 10.0.100
[Host]     : .NET 10.0.0 (10.0.0, 10.0.25.52411), X64 RyuJIT x86-64-v4
DefaultJob : .NET 10.0.0 (10.0.0, 10.0.25.52411), X64 RyuJIT x86-64-v4

This Benchmark is available Here