Reputation: 27
I have a login project which authenticates the user(....obviously) and another project Load which is referenced in the login project. Now, I need to access a data member of a class of the login project in a class of the Load project but how do I do this without running into circular dependency? I don't see how referencing login dll or creating a separate project referencing login and in turn referenced by Load would solve this.
Both projects are windows forms.
Thanks for your patience. I know it's a silly question and I am truly sorry about that.
Upvotes: 0
Views: 187
Reputation: 1948
Your situation is like this:
Project A
+-> References Project B
+- Class X
Project B
+- Class Y
+- Needs Data from Class X
There are two ways to resolve this:
Move the data from Class X that you need in Class Y to some class in Project B. Now both Projects have access to the information.
Move the date from Class X that you need in Class Y to some class in a third Project C and reference that from both other Projects. Large solutions often have a 'Data' or 'Model' Project that holds data classes used by multiple other projects
Upvotes: 1
Reputation: 90
One way of dealing with circular references is: Extract interfaces from both "login" and "load" project and put them in to a single project, which you will reference.
Upvotes: 0