如何解决循环依赖 [英] how to resolve circular dependency
问题描述
我已经加入另一个项目XML我的项目同步。
I have added another project "xml" to my project "synchronise".
所以Program.cs中(在XML项目)运行getDetails(),它运行FectchDetails()中的同步项目并返回结果为对象到XML / getDetails()。
So program.cs (in the xml project) runs the getDetails(), which runs the FectchDetails() in the synchronise project and returns the result as an object to the xml/getDetails().
如果在调校/ FecthDetails发生错误()我想重新运行XML / getDetails()。
If an error occurs in the Synchronise/FecthDetails() I want to re run the xml/getDetails().
我用尽xml.getDetails,但跟它它不存在,因为它不是参考的项目,所以我尝试将XML项目添加到synchroinse但它告诉我,我不能这样做,因为这将导致循环依赖。 ...我怎样才能解决这个
Ive tried xml.getDetails, but it is saying it doesnt exist, because its not reference to the project so I try to add the xml project to the synchroinse but its telling me I cant do this as it would cause circular dependency....how can I resolve this
感谢
推荐答案
如果您遇到调校/ FecthDetails()内的误差,想必你可以抛出一个应用程序异常并捕获在XML / getDetails。然后,你可以决定是否重新尝试,或通知用户的。
If you encounter an error within Synchronise/FecthDetails(), propbably you can throw an application exception and catch that in xml/getDetails. Then you can decide whether to re-try or inform the user about it.
我很抱歉,如果我误解你的问题。如果可能的话后有些psuedo- code。
I am sorry if I misunderstood you question. if possible post some psuedo-code.
这篇关于如何解决循环依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!