1

I build a project in C# with Visual studio 2010. I work with MVC model, (model-view-control) and I created 3 diffrent projects (one for each layer) . Now I try to reference each layer to other. so I added: 1. reference of the view in the control. 2. reference of the model in the control.

but now I need to add reference of the Control in the View, and I get an error about circular dependency.

error how can I solve it?

Erik Philips
  • 53,428
  • 11
  • 128
  • 150
user2970484
  • 89
  • 1
  • 5
  • 12
  • To clarify, what are the 3 projects you created? The error you're getting is because 2 projects are referencing each other. This isn't allowed. – Chris W Dec 24 '13 at 23:25
  • 1
    MVC != 3-tier architecture http://stackoverflow.com/questions/698220/mvc-vs-n-tier-architecture – Prashanth Thurairatnam Dec 24 '13 at 23:26
  • Hi, I have 3 projects. view, model and control. and I have to add reference of the control in the view, and another one in the view of the control. Why it's not allowed? – user2970484 Dec 24 '13 at 23:28
  • It might work better to have the Controllers in the same project with the Views. But the Controller action methods are very short, and they call more complex methods in a Business Logic Layer in another project. – DOK Dec 24 '13 at 23:29
  • Thanks DOK. thats whay I made in the begin.. but I have requirement for 3 diffrent projects . – user2970484 Dec 24 '13 at 23:31
  • Quite often, the Models are in a separate project that is referenced by the UI, BLL and the DAL. That would give you four projects. – DOK Dec 24 '13 at 23:34
  • but what you described it's architecture of MVVM no? I need to do only 3 projects in the regular MVC architecture . – user2970484 Dec 24 '13 at 23:42
  • I believe in pure MVC (which is probaly the goal of the exercise with such strange requirement) there should be no circular dependency: View depends on Model (and possibly on Controller), Controller depends on Model, Model does not depend on either... One will likely still need 4th project for overall app at least for managing commands from view to controller. – Alexei Levenkov Dec 24 '13 at 23:43

0 Answers0