On. NET Circular Reference

Source: Internet
Author: User
Keywords And then this the solution so that the eye
Tags class creating a development development patterns framework how to how to solve net

In an era of increasing development patterns and widespread frameworks, more and more people rely on the development of the inherent framework pattern and ignore the understanding of the underlying architecture of the project. So when you deploy the project structure, you will encounter a "circular reference" problem that I encountered today.

In fact, it's not complicated, I have 5 projects a,b,c,d,e, and then I reference the Class B in Project A, and then I reference the class of C in B, and then I refer to the class in C, which makes a circular reference.

  

How can we solve this problem?

Solution One:

We consider creating a new project Z and then adding a reference to the a,b,c separately so that a,b,c just references Z.

Solution Two:

You can also create a class library project and then a,b,c,d,e,f ... The classes that need to be referenced are put into this class library project, and then all references to the class library project are OK.

In fact, the above two solutions have the same place, that is, by creating a "third party" project to do a bridge, consolidate the need to share the class, and then reference it together.

In short, or in the actual project to experience, to feel!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.