New Operators: SequentialAnd and SequentialOr

オープン
#565 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
csharp
領域
backend

調査の方向性

ファイル、テスト、エントリーポイントは指定されていません。まず既存の And および Or 演算子と、それらのルールエンジンのテストを見つけ、次に逐次的な短絡評価の動作が現在の構造にどのように適合するかを評価してください。Done には、両方の演算子、包括的なテスト、例を含む明確なドキュメントを含める必要があります。

索引モデルが issue の本文から書いたものです。

説明

enhancement

In many complex scenarios, the order in which rules are evaluated significantly impacts the performance and outcome. Current operators like "And" and "Or" do not provide enough control for scenarios where the evaluation needs to be strictly sequential or stopped early based on certain conditions. "SequentialAnd" and "SequentialOr" are designed to address these limitations, offering more precise control and efficiency.

SequentialAnd:

  • Each rule is evaluated in order. The evaluation proceeds to the next rule only if the current rule is true.
  • If any rule evaluates to false, the entire set immediately fails, and no further rules are evaluated.
  • This is similar to the "And" operator but with the added functionality that the order is strictly followed, and evaluation stops after the first false condition.

Example:

{
  "RuleName": "Sample of SequentialAnd",
  "Rules": [
    { //Rule1 },
    { //Rule2 }, // If this rule fails we stop here with Success.
    { //Rule3 },
  ],
  "Operator": "SequentialAnd"
}

SequentialOr:

  • Each rule is evaluated in order. The evaluation proceeds to the next rule only if the current rule is false.
  • If any rule evaluates to true, the entire set immediately succeeds, and no further rules are evaluated.
  • If all rules are evaluated to false, the entire set immediately fails.
  • This is similar to the "Or" operator but with the added functionality that the order is strictly followed, and evaluation stops after the first true condition.

Example:

{
  "RuleName": "Sample of SequentialOr",
  "Rules": [
    { //Rule1 },
    { //Rule2 }, // If this rule succeed we stop here with Success.
    { //Rule3 },
  ],
  "Operator": "SequentialOr"
}

Implementation Considerations:

  • Ensure compatibility with existing rule engine structures and evaluate the impact on performance.
  • Provide clear documentation and examples for proper usage and understanding.
  • Include comprehensive testing scenarios to ensure reliability and expected behavior.

I invite the community and maintainers to discuss this proposal, the potential impacts, and any additional considerations or improvements. Any insight and feedback is more than appreciated.

Thank you for considering this enhancement. I look forward to your input and collaboration!

主要言語
C#
スター
4.4k
フォーク
616
平均マージ
6分
マージ済み PR(30日)
2

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/RulesEngine のほかの issue

microsoft/RulesEngine の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。