microsoft / RulesEngine

A Json based Rules Engine with extensive Dynamic expression support
https://microsoft.github.io/RulesEngine/
MIT License
3.6k stars 543 forks source link

no applicable aggregate method 'include(Child)' exists" #542

Open vinayagamn opened 11 months ago

vinayagamn commented 11 months ago

Hello,

I have been using this library and got stuck with this issue. When querying a database table using EFCore, DbSet.Include does not seem to work

Below is sample entity/table structure Entity Parent { string id string name Entity child }

Entity Child { string id string parentId string role }

parentDbSet = "DbSet"

Expression: "parentDbSet.Include(i=>i.Child)"

Fails with the error no applicable aggregate method 'include(Child)' exists"

Can please let know, if the rule engine does support EntityFrameworkQueryableExtensions methods

PS: I tried to pass the Child Entity and EntityFrameworkQueryableExtensions as RESettings, no luck either

var reSettingsWithCustomTypes = new ReSettings { CustomTypes = new Type[] { typeof(Child), typeof(EntityFrameworkQueryableExtensions) } }; var rulesEngine = new RulesEngine.RulesEngine(workflow.ToArray(), reSettingsWithCustomTypes);

var rp1 = new RuleParameter("parentDbSet", parentDbSet); List response = await rulesEngine.ExecuteAllRulesAsync("workflow", rp1);

asulwer commented 3 months ago

what version of EF are you using? are the proper dependencies included?