【问题标题】:Inconsistent accessibility: parameter type 'IInventoryServices' is less accessible than method可访问性不一致:参数类型“IInventoryServices”的可访问性不如方法
【发布时间】:2021-02-17 10:33:57
【问题描述】:

IInventoryServices 比方法 InventoryController.InventoryController(IInventoryServices) WebApplication.Api 更难访问

public class InventoryController : ControllerBase
    {
        private readonly IInventoryServices _services;

        public InventoryController(IInventoryServices services)
        {
            _services = services;
        }
    }

【问题讨论】:

标签: .net model-view-controller


【解决方案1】:

显然您的 IInventoryServices 接口不是public。当您没有为接口指定access modifier 时,它默认为“内部”。

投诉是因为尽管您的 InventoryController 类是 public(=可访问任何代码),但构造函数的参数受到限制。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-07
    • 2015-10-05
    • 1970-01-01
    • 2014-10-31
    相关资源
    最近更新 更多