Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nested reference can be accessible from dotnet core 1

I have created Business and DataAccess Layer for my web project using dotnet core. I have added Data access reference in Business layer and referenced the business layer in UI (web project) layer.

I seen, I am able to access my Data access layer from my UI (web) project. I am really wondering, It can lead to violation of any application design.

Appreciate help, if anybody come across this and how to restrict access to data access layer from UI.

enter image description here

like image 761
Nizam Deen Avatar asked Sep 14 '26 19:09

Nizam Deen


1 Answers

Yes, an indirect dependency is a dependency too.

And your toplevel (MVC) project has to reference everything, direct or indirect, in order to get all modules loaded. And to set up the dependency injection.

You can get better separation by introducing an interfaces layer in a separate project. For example IBusinessClass and IDataAccessClass.

That works for everything but the main project so if you want this particular separation from your example, move your Controllers to a separate project and depend that on the IBusiness interfaces only. Though I'm not sure how that works with MVC's conventions.

like image 153
Henk Holterman Avatar answered Sep 17 '26 18:09

Henk Holterman