Skip to content

Support custom identity key for facts #336

@douglasg14b

Description

@douglasg14b

It seems that the Update() workflow is broken when record class are utilized. Likely because of the value-type semantics of records, which mean when a record is changed, the HashCode changes, making any keys in say a dictionary change (In ways they are not supposed to), making the fact un-findable.

Records should be treated as immutable, however, the Update() method doesn't seem to support this as it expects the same object instance to be mutated, not a new object instance returned (ie. with the non-destructive mutation feature)

  • If I mutate a record with a different value in an Update() I receive a Facts for update do not exist exception.
  • If I use Update() the myRecord with { MyProp = newValue } syntax, I appear to enter an infinite loop of some sort
  • If I retract the fact, change the fact, and then insert the fact I end u in an infinite retract -> insert -> retract -> insert loop for the rule(s)

It also seems that because of the retraction of the fact in order to update it, it is not possible to make use of the [Repeatability] attribute 🤔

If there is already support for this, how? If not, what sort of outlook does such support have? Is this something I could help implement?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions