Updated GuanExamples (fixes breaking change).

This commit is contained in:
Charles Torre 2022-02-01 17:05:56 -08:00
Родитель 1919dfda15
Коммит 6c2dd1795a
3 изменённых файлов: 14 добавлений и 7 удалений

Просмотреть файл

@ -4,6 +4,6 @@
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Logic.Guan" Version="1.0.3" />
<ProjectReference Include="..\Guan\Guan.csproj" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Guan.Logic;
@ -16,15 +15,15 @@ namespace GuanExamples
public async Task RunQueryAsync(string queryExpression, bool showResult = false)
{
// Required QueryContext instance.
QueryContext queryContext = new QueryContext();
// Required ModuleProvider instance. You created the module used in its construction in Program.cs.
ModuleProvider moduleProvider = new ModuleProvider();
moduleProvider.Add(module_);
// The Query instance that will be used to execute the supplied logic rule, queryExpression arg.
Query query = Query.Create(queryExpression, queryContext, moduleProvider);
// Required QueryContext instance. You must supply moduleProvider (it implements IFunctorProvider).
QueryContext queryContext = new QueryContext(moduleProvider);
// The Query instance that will be used to execute the supplied query expression over the related rules.
Query query = Query.Create(queryExpression, queryContext);
// Execute the query.
// result will be () if there is no answer/result for supplied query (see the simple external predicate rules, for example).

Просмотреть файл

@ -0,0 +1,8 @@
{
"profiles": {
"GuanTest": {
"commandName": "Project",
"commandLineArgs": "Scripts\\p1.test"
}
}
}