저는 Spring.net 의존성 삽입 프레임 워크로 프로젝트를 업데이트했습니다. 그런 다음 간단한 로깅/추적 메커니즘을 사용하기 위해 AOP를 통합하는 작업을 계속했습니다. 나는 나의의 app.config에서 원형 dependendy 몇 가지 문제가 있었다, 그러나 나는 그것을했다 :Spring.net AOP가 WPF 데이터 바인딩을 방해하는 것 같습니다.
내 클래스는 다음과 같습니다<spring>
<context>
<resource uri="config://spring/objects"/>
</context>
<objects xmlns="http://www.springframework.net">
<object id="loggingAroundAdvice" type="SetupBuilder.LoggingAroundAdvice"/>
<object id="myServiceObjectTarget" type="SetupBuilder.SetupBuilderModelView, SetupBuilder">
<!--<object name="Model" type="SetupBuilder.SetupBuilderModelView, SetupBuilder">-->
<constructor-arg index="0" ref="MasterData"/>
<property name="FileSelection" ref="FileSelection"/>
<property name="Persistence" ref="Persistence"/>
<property name="Distributor" ref="Distributor"/>
<property name="Document" ref="Document"/>
<property name="StatusWindow" ref="StatusWindow"/>
</object>
<object name="Model" type="Spring.Aop.Framework.ProxyFactoryObject">
<property name="target" ref="myServiceObjectTarget"/>
<property name="interceptorNames">
<list>
<value>loggingAroundAdvice</value>
</list>
</property>
</object>
<object name="MasterData" type="VMRedistMasterData.Implementation.VMRedistMasterDataImpl, VMRedistMasterData"/>
<object name="FileSelection" type="SetupBuilder.OpenAndSaveDialog, SetupBuilder"/>
<object name="Persistence" type="VMRedistDelivery.Implementation.Persistence.DeliveryPersistence, VMRedistDelivery"/>
<object name="Distributor" type="VMRedistDelivery.Implementation.Distribution.Distributor, VMRedistDelivery"/>
<object name="Document" type="Word2010ReleaseDocument.Word2010ReleaseDocument, Word2010ReleaseDocument"/>
<object name="StatusWindow" type="SetupBuilder.WpfStatusWindow, SetupBuilder">
<constructor-arg index="0" ref="Model"/>
</object>
</objects>
: 여기
public interface ISetupBuilderModelViewDependencies
{
IVMRedistMasterData MasterData { get; set; }
IFileSelection FileSelection { get; set; }
IVMRedistPersistence Persistence { get; set; }
IVMRedistDistributor Distributor { get; set; }
IVMRedistReleaseDocument Document { get; set; }
IStatusWindow StatusWindow { get; set; }
}
public class SetupBuilderModelView : ISetupBuilderModelView, ISetupBuilderModelViewDependencies, INotifyPropertyChanged
{
...
public string Customer
{
get { return customer; }
set
{
customer = value;
FirePropertyChanged("Customer");
}
}
...
}
할당 모델 객체입니다 내 기본 WPF 창 :
public partial class App : Application
{
private void Application_Startup(object sender, StartupEventArgs e)
{
var context = ContextRegistry.GetContext();
var setupBuilderWindow = new SetupBuilderWindow(context.GetObject("Model") as ISetupBuilderModelView);
// SetupBuilderWindow needs an ISetupBuilderModelView argument.
setupBuilderWindow.Show();
}
}
"Model"개체의 변경 사항이 발생하면 내 WPF 창 더 이상 업데이트되지 않습니다! 속성이 변경되었습니다. PropertyChanged 이벤트가 throw되고 사람이 구독했습니다. 그러나 아무도 Property 값을 얻으려고하지 않습니다. 추적/기록 메커니즘이 작동하면 get_Customer()
은 시작시 한 번만 호출 된 다음 다시는 호출되지 않습니다. 나는 그것을 얻지 않는다. Spring.Aop.Framework.ProxyFactoryObject
은 모든 이벤트를 대상 개체에서 모든 구독자에게 전송해야합니까? 그것이 문제가 아니며 이벤트가 도착하면, 부동산에 문제가 있습니까? Proxy 객체가 대상의 속성을 캐싱하고 있습니까? 나는 단지 그것을 얻지 않는다.
app.config의 주석 처리 된 행에 AOP가 없습니다. 위의 행에 주석을 달고 그 행의 주석 처리를 제거하면 모든 것이 정상적으로 작동합니다.
혹시 궁금한 점이 있으면 알려 주시기 바랍니다. 나는 너무 많은 정보를 충분하게 제공했으면 좋겠다. 추가 정보가 필요하면 제공해 드리겠습니다.
myServiceObjectTarget 객체를 Model 객체로 이동하지 못했습니다. 팩토리를 프로그래밍 방식으로 호출하면 작동하지 않습니다. – dutop
공장에서 만든 오브젝트는 생각만큼 정상적인 오브젝트에 연결하기가 힘듭니다. _only_는 WPF 창에 의한 변경에 반응합니다. SetupBuilderModelView 클래스 내의 변경 내용이 나타나지 않습니다. – dutop