Go to file
2021-08-13 14:55:08 -04:00
PoweredSoft.DynamicQuery multi target :) 2021-08-13 14:55:08 -04:00
PoweredSoft.DynamicQuery.AspNetCore multi target :) 2021-08-13 14:55:08 -04:00
PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson multi target :) 2021-08-13 14:55:08 -04:00
PoweredSoft.DynamicQuery.Cli 3.0.0 ready with EF5 + NET5 2021-08-13 13:10:15 -04:00
PoweredSoft.DynamicQuery.Core multi target :) 2021-08-13 14:55:08 -04:00
PoweredSoft.DynamicQuery.NewtonsoftJson multi target :) 2021-08-13 14:55:08 -04:00
PoweredSoft.DynamicQuery.Test multi target :) 2021-08-13 14:55:08 -04:00
.gitattributes Add .gitignore and .gitattributes. 2018-10-17 18:30:53 -05:00
.gitignore Add .gitignore and .gitattributes. 2018-10-17 18:30:53 -05:00
DynamicQuery.sln 3.0.0 ready with EF5 + NET5 2021-08-13 13:10:15 -04:00
LICENSE.md Create LICENSE.md 2018-10-21 16:14:57 -05:00
README.md Update README.md 2019-12-12 18:06:25 -06:00

Dynamic Query

It's a library that allows you to easily query a queryable using a criteria object.

It also offers, to intercept the query using IQueryInterceptor implementations.

Breaking Changes

If you are moving up from v1, the breaking changes details are lower.

Getting Started

Install nuget package to your awesome project.

Full Version NuGet NuGet Install
PoweredSoft.DynamicQuery NuGet PM> Install-Package PoweredSoft.DynamicQuery
PoweredSoft.DynamicQuery.Core NuGet PM> Install-Package PoweredSoft.DynamicQuery.Core
PoweredSoft.DynamicQuery.AspNetCore NuGet PM> Install-Package PoweredSoft.DynamicQuery.AspNetCore
PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson NuGet PM> Install-Package PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson

Using in ASP.NET Core

The package Asp.net core of dynamic query will help you start to use Dynamic Query faster in your web project.

For NET CORE 2.x look at v2.0 branch.

New in 2.1.3

You may now add a IQueryInterceptorProvider to return interceptors on top of being able to use AddInterceptor.

public interface IQueryInterceptorProvider
{
    IEnumerable<IQueryInterceptor> GetInterceptors<TSource, TResult>(IQueryCriteria queryCriteria, IQueryable<TSource> queryable);
}

How to configure during startup (NET Core 3)

using PoweredSoft.DynamicQuery.AspNetCore.NewtonsoftJson;

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services
            .AddMvc()
            .AddPoweredSoftJsonNetDynamicQuery();
    }
}

How to use in a controller


[HttpGet]
public IQueryExecutionResult<OfSomething> Get(
            [FromServices]YourContext context, 
            [FromServices]IQueryHandler handler, 
            [FromServices]IQueryCriteria criteria,
            int? page = null,
            int? pageSize = null)
{
    criteria.Page = page;
    criteria.PageSize = pageSize;
    IQueryable<OfSomething> query = context.Somethings;
    var result = handler.Execute(query, criteria);
    return result;
}

[HttpPost]
public IQueryExecutionResult<OfSomething> Read(
    [FromServices]YourContext context, 
    [FromServices]IQueryHandler handler,
    [FromBody]IQueryCriteria criteria)
{
    IQueryable<OfSomething> query = context.Somethings;
    var result = handler.Execute(query, criteria);
    return result;
}

New support for async

[HttpPost]
public async Task<IQueryExecutionResult<OfSomething>> Read(
    [FromServices]YourContext context, 
    [FromServices]IQueryHandlerAsync handler,
    [FromBody]IQueryCriteria criteria)
{
    IQueryable<OfSomething> query = context.Somethings;
    var result = await handler.ExecuteAsync(query, criteria);
    return result;
}

Sample Web Project - ASP.NET CORE + EF Core

Visit: https://github.com/PoweredSoft/DynamicQueryAspNetCoreSample

Breaking Changes if you are migrating from 1.x

Response interface, is now generic IQueryResult<T> which impacts the way to execute the handler.

Grouping results

Since the results are now generic, it's no longer a List