Given the situation that I have a .NET Core 2.0 Application I also have a Web assembly, a Business assembly, and a DataAccess assembly.
I don't want the Web assembly to directly reference my DataAccess assembly (Which has my Entity Framework stuff inside of it). This to protect the Web assembly from taking shortcuts and talking to the DbContext directly.
So I have my Web referencing Business and Business referencing DataAccess.
Now for some odd reason, in the Controllers in my Web project, I can still directly access the DbContext
, because this is marked as public in my DataAccess project, and apparently it is given to the Web project by some form of nested references.
I suppose a similar topic is this one: https://github.com/aspnet/Mvc/issues/6635 But I couldn't find much on the subject here on Stack Overflow.
Is there any elegant way to prevent these nested dependencies to be accessed by the top level project?