title: How to Solve Circular Dependency
body: <p>Hi I have a problem with the structure of my code, it somehow goes into Circular Dependency. Here is an explanation of how my code looks like:</p>
  
  <p>I have a <strong><em>ProjectA</em></strong> contains <strong>BaseProcessor</strong> and <strong>BaseProcessor</strong> has a reference to a class called <strong>Structure</strong> in <strong><em>ProjectB</em></strong>. Inside <strong>BaseProcessor</strong>, there is an instance of <strong>Structure</strong> as a variable.</p>
  
  <p>In <strong><em>projectB</em></strong> there are someother classes such as <strong>Pricing</strong>, <strong>Transaction</strong> etc.
  Every class in <strong><em>ProjectB</em></strong> has a base class called <strong>BaseStructure</strong> i.e. <strong>Structure</strong>, <strong>Pricing</strong> and <strong>Transaction</strong> classes all inherited from <strong>BaseStructure</strong>.
  Now in <strong>Pricing</strong> and <strong>Transaction</strong> classes, I want to call a method in <strong>BaseProcessor</strong> class from <strong>BaseStructure</strong> class which causing Circular Dependency.</p>
  
  <p>What I have tried is:
  <br/>
  Using Unity, but I didn't figure out how to make it work because I try to use function like:
  unityContainer.ReferenceType(IBaseProcessor, BaseProcessor) 
  in <strong>BaseStructure</strong> then it will need a reference of <strong>BaseProcessor</strong> which also cause Circular Dependency.</p>
  
  <p>And I've also tried creating an interface of <strong>IBaseProcessor</strong> and create a function(the function I want to call) declaration in this interface. And let both <strong>BaseProcessor</strong> and <strong>BaseStructure</strong> inherit this interface. But how can I call the function in <strong>Pricing</strong> and <strong>Transaction</strong> class without create an instance of <strong>BaseProcessor</strong>?</p>
  
  <p>Can anyone please tell me how to resolve this problem other than using reflection?</p>
  
  <p>Any help will be much appreciated. Thanks :)</p>