Click here to Skip to main content
15,889,034 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Now here is a conundrum which is bugging me for the past week, as I just want to brush up my rusting programming skills I come across this video “http://www.youtube.com/watch?v=oFgl71x1PX4” it seem quite interesting and I tried to take that as an inspiration and tried to follow the footsteps.
But I can tell you I have tried standing on my head and could not solve this problem, I don’t know that programmer who is writing this program has thrown fairy dust on spectators, he makes it so easy and functional but hell I cannot get pass the adding references bit it’s a three tire program I guess, it’s Access and Domain and Session. Believe me I have tried my best The main Access will in no circumstance will let me add reference and keep on giving me circular dependencies error.
Is he hiding something or as novice at the age of 46 I cannot get it, what is the problem ? I am using Visual Studio 2013 !
Posted
Comments
Ziee-M 21-Feb-14 4:46am    
circular dependencies mean First Project have a reference to Second Project and vis versa, its not allowd to do so, You have to choose a unique sense. 1 reference 2 or 2 ref 1 but not both eference each other
Jahangir Khan 21-Feb-14 6:11am    
Thank you ever so much Ziee-M it's indeed very knid of you to explain that, and I will be honest I did had a slight idea about that, and of course your comment has made it a bit more clear, but I assume that you might have seen the link, as you have been so kind to use your valueable time to read my question, if you do take a look at the short video where this programmer is building this solution, I have done exect (ditto) of what he is doing, but ironic thing is that his is working and mine is not, so question was did I miss something there ?

1 solution

You don't just add references willy-nilly - they are saying that "this needs to access classes in this assembly" and if you just add them at will you will get circular references. This is because it looks at the assemblies you reference to decide if they have changed, and thus it needs to load them again. If Assembly A references Assembly B and B changes, then A needs to be rebuilt because it may be using code in B which has changed. To check the "changedness" of B, it looks at it's references as well - so it B references A, then you have a loop and neither can be successfully compiled because compiling A means B needs to be recompiled, which means A needs to be recompiled. VS doesn't like that! :laugh:

If you have three assemblies: the PresentationLayer, the BusinessLayer, and the DataAccessLayer, then clearly the PL needs to access the BL, and possibly the DAL - but the BL should never try to access the PL, and neither should the DAL.

If there is a case where two assemblies need to access code in the other, then the best thing to do is separate out that common code into one or more discrete assemblies that need no external references, and have both the original assemblies reference that instead.
 
Share this answer
 
Comments
Jahangir Khan 21-Feb-14 6:14am    
Thank you ever so much OG as I wrote to another I am posting the same, it's indeed very knid of you to explain that, and I will be honest I did had a slight idea about that, and of course your comment has made it a bit more clear, but I assume that you might have seen the link, as you have been so kind to use your valueable time to read my question, if you do take a look at the short video where this programmer is building this solution, I have done exect (ditto) of what he is doing, but ironic thing is that his is working and mine is not, so question was did I miss something there ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900