
XLinq
What and why is Xlinq
Xlinq is a data processing language to safely transform data with a somewhat simple to use script.
The focus is to be very easy to expand or lock down to what is needed.
In our case we needed a way to give users the ability to create own scripts that aggregate data without any risk of users getting access to funtionality they should not aquire.
Xlinq has a ExpressionBuilder which is used to parse, compile and run scripts.
Some function-sets are provided in the base implementation, these can be removed or extended to fit any circumstance.
You can check out what´s new in the Version history
Getting Stated
Installation
Just add a Reference to the Nuget-Package: Xlinq
NuGet\Install-Package Xlinq -Version 0.1.13
dotnet add package Xlinq --version 0.1.13
Without Scope
using Xlinq.Expressions;
// ...
var eb = new ExpressionBuilder();
var compiled = eb.Compile("1+2");
Assert.Equal(3, compiled.Invoke(null));
// ...
Scoped
using Xlinq.Expressions;
using Xlinq.Scope;
// ...
var eb = new ExpressionBuilder();
var compiled = eb.Compile("Variable_1.split(' ').length() + Variable_2");
// After beeing compiled you can invoke the function with a scope to get the result for the given data
var scope = new DataScope() {
Variables = new () {
{ "Variable_1", "This is a test" },
{ "Variable_2", 100d }
}
};
Assert.Equal(104, compiled.Invoke(scope));
// ...
Reference
The reference is split into the function-sets implemented into Xlinq by default (In this version TODO: add version)