タイプのルールは含まれていません。まず、ビジネスルールエバリュエーターを作成するためにwww.codeeffects.comフレームワークを使用しますが、私の場合、タイプは100% 。与えられたルールセットには、System.Object、mscorlib、
私は私のProof of Conceptメソッドに次のコードを書いています。
public ActionResult Save(RuleModel ruleEditor)
{
DummyEntitiesGen gen = new DummyEntitiesGen();
Type t = gen.CreateType();
List<dynamic> lista= gen.CreateTypeList();
// At this point the rule model doesn't know which type to use as its source object
// We need to "bind" the source type to the rule model
ruleEditor.BindSource(t);
// Add the rule model to the ViewBag object
ViewBag.Rule = ruleEditor;
// Make sure that the Rule Area is not empty and the current rule is valid
if (ruleEditor.IsEmpty() || !ruleEditor.IsValid(StorageService.LoadRuleXml))
{
ViewBag.Message = "The rule is empty or invalid";
return View("Index");
}
try
{
// Save the rule
StorageService.SaveRule(
ruleEditor.Id,
ruleEditor.GetRuleXml(),
ruleEditor.IsLoadedRuleOfEvalType == null ?
true : (bool)ruleEditor.IsLoadedRuleOfEvalType);
// Get all rules for Tool Bar and context menus and save it in the bag
this.LoadMenuRules();
DynamicEvaluator evaluator = new DynamicEvaluator(ruleEditor.GetRuleXml());
//bool success = evaluator.Evaluate(lista, ruleEditor.Id);
IEnumerable<dynamic> result = lista.Filter<dynamic>(ruleEditor.GetRuleXml());
//var result = lista.AsQueryable<t>().Filter(ruleEditor.GetRuleXml());
ViewBag.Message = "The rule was saved successfully";
}
catch (Exception ex)
{
ViewBag.Message = ex.Message;
}
return View("Index");
}
オブジェクトリスタは結構です、私はデバッグ時に見ることができることを作成したダイナミック型のリストを返します。フィルタリングすることになっている行は私にこの例外を与えているが
:
与えられたルールセットは、タイプのSystem.Objectを持つ任意のルールが含まれていない、mscorlib