Question

I have added another project "xml" to my project "synchronise".

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().

If an error occurs in the Synchronise/FecthDetails() I want to re run the xml/getDetails().

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

thanks

Was it helpful?

Solution 2

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.

I am sorry if I misunderstood you question. if possible post some psuedo-code.

OTHER TIPS

Basically, you have a project X depending on project Y (X --> Y) , and project Y depending on project X ( Y --> X).

In other words, something like: ( X <---> Y)

This situation means that the compiler does not know what to compile first, and therefore complains.

To solve this, look for common things / pieces of logic that can be moved out from one or both of the projects, and create a third project that can be built before both of the others.

Place all common stuff in this new project, and you should be fine; your dependency should then be as below, where it does not matter if X or Y is compiled first, as long as Z is compiled before both of them:

( X --> Z <-- Y )

You get circular dependency when:

A depends on B and B depends on A.

If you think both need this dependency then they should belong to one project.

you can move FetchDetails() to another project and reference to this project from both xml and synchronise projects

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top