microsoft / RulesEngine

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

Ef Derived Class concern #588

Open R1Dev opened 4 months ago

R1Dev commented 4 months ago

Discussed in https://github.com/microsoft/RulesEngine/discussions/587

Originally posted by **R1Dev** February 28, 2024 Hello! I added the classes to ef as herited classes like https://github.com/alexreich/RulesEngineEditor did. When I Get the WorkflowData object, I get 2 Rules Properties and Rules Engine wants to have data in (RulesEngine) one How to proceed to get a single propertie? public class WorkflowData : RulesEngine.Models.Workflow { public long Id { get; set; } public Guid TenantId { get; set; } public new IEnumerable Rules { get; set; } public new IEnumerable GlobalParams { get; set; } public int Seq { get; set; } } Capture d'écran 2024-02-28 013537
R1Dev commented 4 months ago

If I remove public new IEnumerable Rules { get; set; } public new IEnumerable GlobalParams { get; set; } I get following error in migration : Unable to determine the relationship represented by navigation 'Rule.Actions' of type 'RuleActions'. Either manually configure the relationship, or ignore this property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.

asulwer commented 1 week ago

your workflow could contain multiple Rules and ChildRules. This is by default. in your example your Include will get all parent Rules in that workflow, ThenInclude gets all of the child rules for each parent rule. it does not go deeper.