Home

Awesome

Library Powered By

This library is powered by Entity Framework Extensions

<a href="https://entityframework-extensions.net/?z=github&y=system.linq.dynamic.core"> <kbd> <img src="https://zzzprojects.github.io/images/logo/entityframework-extensions-pub.jpg" alt="Entity Framework Extensions" /> </kbd> </a>

System.Linq.Dynamic.Core

This is a .NET Core / Standard port of the Microsoft assembly for the .Net 4.0 Dynamic language functionality.

Overview

With this library it's possible to write Dynamic LINQ queries (string based) on an IQueryable:

var query = db.Customers
    .Where("City == @0 and Orders.Count >= @1", "London", 10)
    .OrderBy("CompanyName")
    .Select("new(CompanyName as Name, Phone)");

Interpolated strings are supported on .NET 4.6(and above), .NET Core 2.1(and above), .NET Standard 1.3(and above) and UAP 10.0(and above). For example:

string cityName = "London";
int c = 10;
db.Customers.WhereInterpolated($"City == {cityName} and Orders.Count >= {c}");

:exclamation: Breaking changes

v1.3.0

A breaking change is introduced in version 1.3.0 which is related to calling methods on classes. Due to security reasons, it's now only allowed to call methods on the standard predefined classes like (bool, int, string ...). If you want to call a method on an own custom class, annotate that class with the DynamicLinqType. Example:

[DynamicLinqType]
public class MyCustomClass
{
    public int GetAge(int x) => x;
}

If it's not possible to add that attribute, you need to implement a custom CustomTypeProvider and set this to the ParsingConfig and provide that config to the dynamic call.

Useful links

Info

Project 
  ChatGitter
  IssuesGitHub issues
Quality 
  CI WorkflowCI Workflow
  SonarCloudQuality Gate Status
NuGet 
  System.Linq.Dynamic.CoreNuGet
  EntityFramework.DynamicLinqNuGet
  Microsoft.EntityFrameworkCore.DynamicLinqNuGet
  Z.EntityFramework.Classic.DynamicLinqNuGet

Development Details

Frameworks

The following frameworks are supported:

Fork details

This fork takes the basic library to a new level. Contains XML Documentation and examples on how to use it. Also adds unit testing to help ensure that it works properly.

Some background: I forked from https://github.com/NArnott/System.Linq.Dynamic and added some more functionality there.<br>My fork is still visible on github [https://github.com/StefH/System.Linq.Dynamic], however I decided to start a new project + nuget to avoid confusion and create the project according to the new VS2017 + .NET Core rules / standards.

However, currently there are multiple nuget packages and projects available:

ProjectNuGetAuthorComment
kahanu/System.Linq.DynamicSystem.Linq.Dynamic@kahanu-
kavun/System.Linq.Dynamic.3.5System.Linq.Dynamic.3.5/@kavunonly 3.5 and VB.NET
NArnott/System.Linq.DynamicSystem.Linq.Dynamic.Library@NArnottremoved from github + nuget ?
dynamiclinq.codeplex-dialectsoftware-
dynamic-linq-scottgu-

Contribute

The best way to contribute is by spreading the word about the library:

A HUGE THANKS for your help.

More Projects

To view all our free and paid projects, visit our website ZZZ Projects.