Webority.DataTables 0.0.2

dotnet add package Webority.DataTables --version 0.0.2
                    
NuGet\Install-Package Webority.DataTables -Version 0.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="Webority.DataTables" Version="0.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Webority.DataTables" Version="0.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Webority.DataTables" />
                    
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 Webority.DataTables --version 0.0.2
                    
#r "nuget: Webority.DataTables, 0.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 Webority.DataTables@0.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=Webority.DataTables&version=0.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Webority.DataTables&version=0.0.2
                    
Install as a Cake Tool

Webority.DataTables

High-performance ASP.NET Core DataTables library with .NET 9 optimizations for seamless integration with DataTables.js.

Features

  • 🚀 Optimized for .NET 9 - Leverages latest performance features
  • 📊 Server-side Processing - Efficient handling of large datasets
  • 🔧 Model Binding - Automatic request parameter binding
  • 🔍 Advanced Querying - Support for searching, sorting, and pagination
  • 💾 Memory Efficient - Object pooling and reduced allocations
  • Expression Caching - Compiled expressions for better performance
  • 🔄 Async Support - Full async/await pattern implementation
  • 🎯 Type Safe - Strongly typed interfaces and implementations

Installation

dotnet add package Webority.DataTables

Quick Start

1. Configure Services

builder.Services.AddDataTables();

2. Controller Implementation

[HttpPost]
public async Task<IActionResult> GetData([DataTablesRequest] IDataTablesRequest request)
{
    var query = _context.Products.AsQueryable();
    
    // Apply DataTables operations and get response
    var response = await query.ToDataTablesResponseAsync(request);
    
    return DataTablesResult(response);
}

3. Client-side Setup

$('#myTable').DataTable({
    processing: true,
    serverSide: true,
    ajax: {
        url: '/api/products/data',
        type: 'POST'
    },
    columns: [
        { data: 'name' },
        { data: 'price' },
        { data: 'category' },
        { data: 'stock' }
    ]
});

Advanced Usage

Custom Query Builder

var builder = query.ToDataTablesBuilder(request, new QueryOptimizationOptions
{
    UseParallelExecution = true,
    UseCompiledExpressions = true,
    CacheTotalCount = true
});

var response = await builder.ExecuteAsync();

Projection for Better Performance

var response = await query.ToDataTablesResponseAsync(request, 
    product => new ProductDto
    {
        Id = product.Id,
        Name = product.Name,
        Price = product.Price
    });

Custom Search Implementation

public static IQueryable<T> ApplyCustomSearch<T>(this IQueryable<T> query, IDataTablesRequest request)
{
    if (!string.IsNullOrEmpty(request.Search?.Value))
    {
        // Apply custom search logic
        query = query.Where(/* your predicate */);
    }
    return query;
}

Performance Optimizations

This library includes several performance optimizations:

  • Expression Caching: Frequently used expressions are cached using ConcurrentDictionary
  • String Operations: Optimized with .NET 9's SearchValues<T> API
  • Memory Pooling: Reduces GC pressure through ArrayPool<T> and object pooling
  • Frozen Collections: Uses FrozenDictionary and FrozenSet for read-only lookups
  • Async Patterns: Efficient async query execution with parallel operations

Configuration Options

services.AddDataTables(options =>
{
    options.UseParallelExecution = true;
    options.CacheTotalCount = true;
    options.LargePageSizeThreshold = 1000;
    options.MaxSearchableColumnsThreshold = 10;
});

Benchmarks

Performance improvements with .NET 9 optimizations:

  • Query performance: 61.3% faster
  • Expression caching: 3000 expressions in 5ms
  • String operations: 20,000 operations in 4ms
  • Object pooling: 1000 pooled objects in 1ms

Requirements

  • .NET 9.0 or later
  • ASP.NET Core 9.0 or later
  • DataTables.js 1.10.0 or later

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For issues and feature requests, please use the GitHub Issues page.

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
0.0.2 150 7/3/2025
0.0.1 139 7/2/2025

v0.0.2 - Complete drop-in replacement for web.common DataTables
- Added missing extension methods (GetSortedColumns, ParseColumnSearchEnumValue, etc.)
- Added DataTablesJsonResult constructor with boolean allowGet parameter
- Added dynamic query support (ApplySearch, ApplySorting, ApplyPaging)
- Added optimized async methods (ToDataTablesResponseAsync, ToDataTablesJsonResultAsync)
- Removed System.Linq.Dynamic.Core dependency - using expressions instead
- Added Entity Framework Core integration
- Improved API to reduce boilerplate code

v0.0.1 - Initial preview release with .NET 9 performance optimizations
- Expression caching for improved performance
- String operations optimization with SearchValues API
- Memory allocation reduction through object pooling
- Collection optimizations with FrozenDictionary/FrozenSet
- Async query patterns for better scalability
- Full backward compatibility maintained