Frage

In ReSharper, there is the Architecture View window and in it there is the term of transitive references but it's a little confusing as of what it really means. This blog post from them covers it but in an incomplete manner.

I'm starting to think that this option is solely here for simplifying a solution diagram, is this correct?

If not, can you explain what does transitive reference mean?

War es hilfreich?

Lösung

When ReSharper speaks of a transitive reference, it means a reference to an assembly that is made implicitly by referencing another, intermediary assembly. For example, say I have a project with an assembly "Core.dll". I create a project called "Features.dll" that references Core.dll. This is a direct reference.

Now say I add a test project, Features.Tests.dll. This assembly tests the code in Features.dll, and so has a direct reference to Features.dll. The references then look like this:

Features.Tests.dll -(References)-> Features.dll -(References)-> Core.dll

Each dll directly references the dll it uses. But we can also say that Features.Tests.dll has a "transitive reference" on Core.dll. I.e.:

Features.Tests.dll -(References)-> Core.dll

After all, it can't run if Core.dll isn't present.

When using ReSharper's architecture view, transitive references are hidden by default, firstly to simplify the diagram, but also because the transitive reference is implied - if the diagram shows that Features.Tests.dll references Features.dll, and Features.dll references Core.dll, then it is visually obvious that Features.Tests.dll and Core.dll requires and therefore transitively references Core.dll. You can make the transitive references more visible by enabling the "Show transitive references" button.

One way to remember how transitive references work is to think of maths, e.g. If A > B and B > C, then A > C. The "greater than" is a transitive relation.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top