You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using (var scope = _serviceProvider.CreateScope())
{
var evaluator = scope.ServiceProvider.GetRequiredService();
var executionContext = new ExpressionExecutionContext(scope.ServiceProvider, new MemoryRegister());
executionContext.SetVariable("Name", "Context World");
In console app, Liquid Expressions is not working as expected but CSharp Expressions works. Could you please review and help me to handle this.
@cvijayak Thanks.
```
var host = Host.CreateDefaultBuilder()
.ConfigureServices((context, services) =>
{
services.AddMediator();
services.AddElsa(elsa => {
elsa.UseCSharp();
elsa.UseLiquid();
});
services.AddHostedService();
})
.Build();
await host.RunAsync();
using (var scope = _serviceProvider.CreateScope())
{
var evaluator = scope.ServiceProvider.GetRequiredService();
var executionContext = new ExpressionExecutionContext(scope.ServiceProvider, new MemoryRegister());
executionContext.SetVariable("Name", "Context World");
string e1 = "DateTime.Now.AddDays(1).ToString("yyyy-MM-dd")";
var r1 = await evaluator.EvaluateAsync(new Expression("CSharp", e1), executionContext);
Console.WriteLine(r1);
string e3 = ""Hello, " + Variable.Name";
var r3 = await evaluator.EvaluateAsync(new Expression("CSharp", e3), executionContext);
Console.WriteLine(r3); // Hello, Context World
string e4 = "Hello {{ Variables.Name }}";
var r4 = await evaluator.EvaluateAsync(new Expression("Liquid", e4), executionContext);
Console.WriteLine(r4);
}
The text was updated successfully, but these errors were encountered: