I have created a simple example with below code. In my test project UI layer(.Net Core) I have a dependency to Business Layer and my Business Layer Reference to Data Layer. My question is why UI can import Data Layer functionality without referencing to Data because I really don't want to import that !!
public class Program
{
public static void Main(string[] args)
{
Data.Class1 class1 = new Class1();
class1.foo();//i have access to data layer !!
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
}