Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InMemory providers always returns same instance of rules' object #68

Open
martinhonovais opened this issue Apr 18, 2022 · 1 comment
Open
Labels
enhancement New feature or request medium priority Medium priority issue

Comments

@martinhonovais
Copy link
Contributor

martinhonovais commented Apr 18, 2022

RuleBuilder
    .NewRule<ContentTypes, ConditionTypes>()
    .WithName(RmaInvoiceDisclaimerForShippingCostV3)
    .WithContent(
        ContentTypes.RmaDisclaimerShippingCost,
        new DisclaimersValue(
        "Freight Cost of {Shipping.AmountInclTax} not to be included in grand total")
    )
    .WithDateBegin(DateTime.Parse("2019-01-01"))
    .Build(),
RuleAddPriorityOption.ByPriorityNumber(1) 

Take the above example, if the rule was configured on this away, whenever this rule matches the condition, the instance of the object DisclaimersValue returned is going to be always the same. It means that if the application changes the content of the object then it will be changed for the entire application.

Perhaps the behavior here should be the rules framework returning a new instance of the object for each time that the rules match the conditions.

@martinhonovais martinhonovais added the enhancement New feature or request label Apr 18, 2022
@luispfgarces
Copy link
Contributor

Just adding up, this behavior is exclusive to in-memory data source implementation, perhaps the solution can be thought of as part of in-memory implementation (non-binding, just an observation).

@Daniel-C-Dias Daniel-C-Dias added the medium priority Medium priority issue label May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request medium priority Medium priority issue
Projects
None yet
Development

No branches or pull requests

3 participants