Unity가 AoP 기능을 달성하기 위해 2 개의 다른 경로를 제공하는 것처럼 보입니다.Unity ICallHandler vs. IInterceptionBehavior
질문은 이유가 무엇입니까? 차이점은 무엇입니까? 각 접근법의 장점과 단점은 무엇입니까? 예를 들어
ICallHandler 사용 :
unity.Configure<Interception>()
.AddMatchingRule(
new TypeMatchingRule(typeof (ComplexEntity))
).AddMatchingRule(
new TypeMatchingRule(typeof (ComplexEntity.InnerEntity))
).AddMatchingRule(
new MemberNameMatchingRule("*")
).AddCallHandler(
new CallHandler()
);
그러나 비슷한 기능도 ICallHandler 대신에 IInterceptionBehavior을 사용하여 달성 할 수 있습니다 당신이 차단을 설정하지만 수 있다는 곳도 하이브리드
unity.RegisterType<ComplexEntity,ComplexEntity>
(new VirtualMethodInterceptor(), new InterceptionBehavior)
있다
예를 들어 호출 처리기를 사용합니다.unity.Configure<Interception>()
.SetInterceptorFor<ComplexEntity>(new VirtualMethodInterceptor())
.AddPolicy("TestPolicy")
.AddMatchingRule(
new TypeMatchingRule(typeof (ComplexEntity))
).AddMatchingRule(
new TypeMatchingRule(typeof (ComplexEntity.InnerEntity))
).AddMatchingRule(
new MemberNameMatchingRule("*")
).AddCallHandler(
new CallHandler()
);
그래서 어떤 것을 사용할 수 있습니까? 단일 프레임 워크에서 중복 솔루션이 나타나는 이유는 무엇입니까?
하나의 질문 : PIAB가 향후 버전의 Entlib에서 쓸모 없게된다는 뜻입니까? 따라서 IInterfaceBehaviors에 대한 일치 규칙을 적용 할 수있는 방법은 없습니다. 최상위 계층 클래스와 각 인터페이스 (예 : IBf 및 Bf)를 구현할 때 이름 지정 규칙을 통해 한 번에 등록 할 수있는 유일한 방법은 무엇입니까? 그리고 네임 스페이스 필터를 만들고 그 네임 스페이스 내의 모든 클래스를 반복하십시오 .. – Legends
이것은 Entlib의 소유자에게 달려 있습니다. 나는 그 팀에 더 이상 있지 않고 (몇 년되지 않았 음) 그들의 계획에 대한 통찰력을 가지고 있지 않습니다. –