Skip to content

bricelam/Bricelam.PowerFx.Linq

Repository files navigation

Bricelam.PowerFx.Linq

build status latest version downloads license

Use Power Fx inside of LINQ.

This project translates Power Fx formulas into .NET Expression trees enabling you to use them inside of LINQ queries.

Installation

The latest prerelease version is available on MyGet.

dotnet add package Bricelam.PowerFx.Linq --source https://www.myget.org/F/bricelam/api/v3/index.json

Usage

The PowerFxExpression class allows you to create lambda expressions from formulas.

// TIP: Hardcoded formulas aren't very interesting, but imagine if they're
//      defined outside the code!
var formula = "Radius = 1";

var predicate = PowerFxExpression.Predicate<Circle>(formula);
var query = circles.Where(predicate);

The PowerFxQueryable class provides queryable extension methods that use formulas.

var query = circles
    .AddColumns(
        ("Diameter", "2 * Radius"),
        ("Circumference", "2 * Pi() * Radius")
        ("Area", "Pi() * Radius^2"));

See also

About

Use Power Fx inside LINQ

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors 2

  •  
  •  

Languages