Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

The .NET Standard / .NET Core version from the System Linq Dynamic functionality.

License

NotificationsYou must be signed in to change notification settings

zzzprojects/System.Linq.Dynamic.Core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 anIQueryable:

varquery=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:

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

Sponsors

ZZZ Projects owns and maintainsSystem.Linq.Dynamic.Core as part of ourmission to add value to the .NET community

ThroughEntity Framework Extensions andDapper Plus, we actively sponsor and help key open-source libraries grow.

Entity Framework Extensions

Dapper Plus


❗ Breaking changes

v1.3.0

A breaking change is introduced in this version 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 theDynamicLinqType.Example:

[DynamicLinqType]publicclassMyCustomClass{publicintGetAge(intx)=>x;}

If it's not possible to add that attribute, you need to implement a customCustomTypeProvider and set this to theParsingConfig and provide that config to all dynamic calls.Or provide a list of additional types in theDefaultDynamicLinqCustomTypeProvider.cs.

v1.6.0

Change 1

It's not allowed anymore to call any methods on theobject type. By default also theToString andEquals methods are not allowed.This is done to mitigate the risk of calling methods on theobject type which could lead to security issues (CVE-2024-51417).To allow these methods setAllowEqualsAndToStringMethodsOnObject totrue in theParsingConfig and provide that config to all dynamic calls.

Change 2

By default theRestrictOrderByToPropertyOrField is now set totrue in theParsingConfig.Which means that only properties and fields can be used in theOrderBy /ThenBy.This is done to mitigate the risk of calling methods or other expressions in theOrderBy /ThenBy which could lead to security issues.To allow these methods setRestrictOrderByToPropertyOrField tofalse in theParsingConfig and provide that config to all dynamic calls.

Change 3

TheDefaultDynamicLinqCustomTypeProvider has been changed to only return types which have the[DynamicLinqType] attribute applied.If it's not possible to add that attribute, you need to implement a customCustomTypeProvider and set this to theParsingConfig and provide that config to all dynamic calls.Or provide a list of additional types in theDefaultDynamicLinqCustomTypeProvider.cs.


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
  Z.DynamicLinq.SystemTextJsonNuGet
  Z.DynamicLinq.NewtonsoftJsonNuGet

Development Details

Frameworks

The following frameworks are supported:

  • net35, net40, net45, net46 and up
  • netstandard1.3, netstandard2.0 and netstandard2.1
  • netcoreapp3.1, net5.0, net6.0, net7.0, net8.0 and net9.0
  • uap10.0

Fork details

This fork takes the basic library to a new level. Also adds unit tests to help ensure that it works properly.

Some background:I forked fromhttps://github.com/NArnott/System.Linq.Dynamic and added some more functionality there.
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 byspreading the word about the library:

  • Blog it
  • Comment it
  • Star it
  • Share it

AHUGE THANKS for your help.

More Projects

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


[8]ページ先頭

©2009-2025 Movatter.jp