I created 2 dummy projects in my application and named them BAL
and DAL
. When I build them, they build successfully. If I add a reference to
This problem occurred to me when I was building a WPF application with several layers like repository interface layer, repository service layer, sql service layer, rest service layer and my main WPF UI layer.
========================================================================
Conclusion: Check each projects reference dependency and make sure there are no unnecessary reference. Make sure sub layers are not referencing the startup project in the reference.
Hope I was helpful.
Here's what you need to do:
Right click on the DAL Project in the solution explorer and select Project dependencies in the context menu.
You will now see a window that shows the project dependencies of the DAL Project. Make sure that BAL isn't checked.
Now you should be able to add your reference...
I hope this helps I've tried to keep it as simple and straight forward as possible.
Explanation:
Your DAL should not be able to access the BAL. Your code reference dependencies should be like this:
MVC project -> BAL -> DAL
The MVC project should reference the BAL, the BAL should reference the DAL. Set up your project like this. Make it work and then you will better understand why this setup is better.
Given:
Cosider the following: The UI should get its information from the BAL which could be able to compose it's data based on the DAL.
This just happened to me. You have a circular dependency, i.e. two projects both referencing each other. You need to make one of them independent of the other. Takes some time and it happens so quick. One second I was happily coding along, and the next I had 45 errors like this. Just took some time but it makes your architecture/program structure better too, helping you sort out dependencies properly.