Should I avoid chained links in Visual Studio with class libraries?

I have something like the following setup in a Visual Studio C # .NET solution:

Project 1 - TrainDisplay - WinForms application for displaying train arrivals.

Project 2 - TrainFetcher is a reusable class library for retrieving train data.

Project 3 . TrainsDataModel is a data model that contains classes common to all other projects. Train.cs, TrainRoute.cs, etc.

Each of them has the following links:

Project 1: References 2 and 3

Project 2: References 3

Is it bad to use links this way; those. project 1 ends with two references to project 3; one direct and one through project 2?

+7
source share
1 answer

This is not so in itself; the compiler will do The Right Thingยฎ.

But this may be a sign of not very large design.

Try to create three layers in such a way that 2 depends only on 3, and 1 depends only on 2.

Edit : The last sentence was not clear. I had in mind the following: "design three layers so that your business objects should refer only to a data access code and that the user interface deals only with business objects."

Ultimately, the correct way to do this really depends on your architecture (using ORM versus manually issuing queries, Active Record vs Mapper, etc.).

+5
source

All Articles