Showing classes from indirectly referenced packages in .NET Core

后端 未结 2 1167
迷失自我
迷失自我 2020-12-05 14:54

I am trying to implement basic UoW/Repository pattern with ASP.NET/Entity Framework Core and I have encountered very troubling behavior.

My solution consists of 4 pro

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-05 15:42

    I've been struggling with this for months and finally found a way to disable the transitive references of projects in Core.

    In the .csproj file for .Facade.EF, you can add PrivateAssets="All" to the ProjectReference to .DAL:

    
      
    
    

    With this setting, projects that reference .Facade.EF no longer reference .DAL too.

    In more abstract terms, if you want A to reference B and B to reference C, but don't want A to reference C, add this:

    In B.csproj

    
      
    
    

    Source: https://github.com/dotnet/project-system/issues/2313

提交回复
热议问题