나는 그냥 내가 깊은 다이빙 익사하기 전에 물어보고 싶은게비즈니스 규칙 엔진을 빌드 할 때 확장 메소드를 사용할 수 있습니까?
productBiz.Rule1().Rule2();
productBiz.Rule2().Rule1();
또는
// create multicasted delegate of type Func<ProductBiz,bool> say rulesetDelegate
productBiz.ApplyRules(rulesetDelegate);
으로 사용하는 클라이언트 코드에서 다음이
public class ProductBiz: BizBase<Product> {
public List<String> BrokenRules {get;set;}
// Some kind of data + biz operation implementation
}
public static class ProductBizExtensions{
public ProductBiz Rule1(this ProductBiz prodBiz)
{}
public ProductBiz Rule2(this ProductBiz prodBiz)
{}
public bool ApplyRules (this ProductBiz prodBiz, Func<ProductBiz,bool> ruleset){}
}
같은 것을 할을 찾고 있습니다.
이 방법으로 잠재적 인 함정은 무엇입니까 ???
미리 감사드립니다.
첫 번째 코드 블록에 오타가 있습니까? 두 번째 Rule1은 실제로 Rule2일까요? – MusiGenesis
thanks..corrected – Perpetualcoder