All Projects → xljiulang → Predicatelib

xljiulang / Predicatelib

Licence: mit
谓词筛选表达式Expression<Func<T, bool>>的扩展库

Projects that are alternatives of or similar to Predicatelib

mpsl
Shader-Like Mathematical Expression JIT Engine for C++ Language
Stars: ✭ 52 (+67.74%)
Mutual labels:  expression
FMPN-FER
Official PyTorch Implementation of 'Facial Motion Prior Networks for Facial Expression Recognition', VCIP 2019, Oral
Stars: ✭ 76 (+145.16%)
Mutual labels:  expression
Cel Go
Fast, portable, non-Turing complete expression evaluation with gradual typing (Go)
Stars: ✭ 720 (+2222.58%)
Mutual labels:  expression
SqlBatis
A high performance Micro-ORM supporting SQL Server, MySQL, Sqlite etc..
Stars: ✭ 34 (+9.68%)
Mutual labels:  expression
CoNekT
CoNekT (short for Co-expression Network Toolkit) is a platform to browse co-expression data and enable cross-species comparisons.
Stars: ✭ 17 (-45.16%)
Mutual labels:  expression
booleval
Header-only C++17 library for evaluating logical expressions.
Stars: ✭ 54 (+74.19%)
Mutual labels:  expression
ToolGood.Algorithm
Support four arithmetic operations, Excel formulas, and support custom parameters. 支持四则运算、Excel公式语法,并支持自定义参数。
Stars: ✭ 77 (+148.39%)
Mutual labels:  expression
Metric Parser
📜 AST-based advanced mathematical parser written by Typescript.
Stars: ✭ 26 (-16.13%)
Mutual labels:  expression
formulize
🌘 formula ui generator
Stars: ✭ 82 (+164.52%)
Mutual labels:  expression
Whatif
☔ Fluent expressions of Kotlin for handling single if-else statements, nullable, collections, and boolean.
Stars: ✭ 450 (+1351.61%)
Mutual labels:  expression
eval-estree-expression
Safely evaluate JavaScript (estree) expressions, sync and async.
Stars: ✭ 22 (-29.03%)
Mutual labels:  expression
karnaugh-map-simplifier
Karnaugh map simplification software, used to visually simplify boolean expressions
Stars: ✭ 33 (+6.45%)
Mutual labels:  expression
opel
OPEL - asynchronous expression language
Stars: ✭ 58 (+87.1%)
Mutual labels:  expression
rclc
Mathematical expression calculator with big integers, floats, common fractions, and complex numbers support
Stars: ✭ 24 (-22.58%)
Mutual labels:  expression
Go Tagexpr
An interesting go struct tag expression syntax for field validation, etc.
Stars: ✭ 807 (+2503.23%)
Mutual labels:  expression
SQLBuilder.Core
.NET Standard 2.1、.NET 5、.NET 6 版本SQLBuilder,Expression表达式转换为SQL语句,支持SqlServer、MySql、Oracle、Sqlite、PostgreSql;基于Dapper实现了不同数据库对应的数据仓储Repository;
Stars: ✭ 85 (+174.19%)
Mutual labels:  expression
Remute
C# library to create new immutable object applying lambda expressions to the existing immutable object
Stars: ✭ 57 (+83.87%)
Mutual labels:  expression
System.linq.dynamic.core
The .NET Standard / .NET Core version from the System Linq Dynamic functionality.
Stars: ✭ 864 (+2687.1%)
Mutual labels:  expression
Ccalc
Scientific calculator in which you can define new constants and functions
Stars: ✭ 19 (-38.71%)
Mutual labels:  expression
Flee
Fast Lightweight Expression Evaluator
Stars: ✭ 303 (+877.42%)
Mutual labels:  expression

PredicateLib

PredicateLib是谓词筛选表达式Expression<Func<T, bool>>的一个扩展库,它可以帮你创建一个复杂且灵活的Expression<Func<T, bool>>,以作为EF、MongoDB Driver等ORM框架的查询条件。

nuget

PM> install-package PredicateLib

1 Predicate的创建

1.1 true或false Predicate

var predicate = Predicate.True<User>();

表达式输出

item => true

1.2 通过属性创建Predicate

var predicate = Predicate.Create<User>("age", 2, Operator.GreaterThan);

表达式输出

item => (item.Age > 2)

2 Predicate的逻辑扩展

var predicate = Predicate
    .True<User>()
    .And(item => item.Name == "laojiu");

if (true)
{
    predicate = predicate.And(item => item.Age > 10 && item.Age < 20);
}

表达式输出

item => ((True AndAlso (item.Name == "laojiu")) AndAlso ((item.Age > 10) AndAlso (item.Age < 20)))

3 Condition转换为Predicate

Condition对象支持传入IEnumerable<KeyValuePair<,>>IEnumerable<ConditionItem>等类型作为条件项,然后转换为Predicate,适用于前端传入查询不确定的字段与值,后端不需要修改代码的需求。

var uri = new Uri("http://www.xx.com/?age=1&name=laojiu&id=001");

var condition = uri.AsCondition<User>()
    .OperatorFor(item => item.Age, Operator.GreaterThan)
    .IgnoreFor(item => item.Id);

var predicate = condition.ToAndPredicate();

表达式输出

item => ((item.Age > 1) AndAlso item.Name.Contains("laojiu".Value))
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].