The Wayback Machine - https://web.archive.org/web/20201103143047/https://github.com/smartstore/SmartStoreNET/issues/1971
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

Rule builder: find uniqueness key for cart rules that can be used for locking (required for RuleSetRule) #1971

Closed
mgesing opened this issue Jun 24, 2020 · 0 comments
Assignees
Labels
bug
Milestone

Comments

@mgesing
Copy link
Contributor

@mgesing mgesing commented Jun 24, 2020

Idea: HashCodeCombiner... extend RuleExpression

public int RuleSetId { get; set; }
public override int GetHashCode()
{
	var combiner = HashCodeCombiner
		.Start()
		.Add(RuleSetId)
		.Add(Id)
		.Add(Operator)
		.Add(RawValue);

	return combiner.CombinedHash;
}

and extend RuleExpressionGroup

public override int GetHashCode()
{
	var combiner = HashCodeCombiner
		.Start()
		.Add(Expressions.Select(x => x.GetHashCode()));

	return combiner.CombinedHash;
}

Add "expression.RuleSetId = entity.RuleSetId" to RuleProviderBase.ConvertRule and group.GetHashCode() to CartRuleContext and use it instead of expression.Id when creating the key.

@mgesing mgesing added the bug label Jun 24, 2020
@mgesing mgesing added this to the 4.1 milestone Jun 24, 2020
@mgesing mgesing closed this in 89aeee3 Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.