无法注入内部接口

时间:2018-08-15 15:27:49

标签: c# interface

无法插入公共服务类内部的接口。

下面是我使用内部修饰符创建的界面。

   internal interface IDespatchTrackingNotifications
   {
     int SendConsolidatedDespatchNotifications(int days);
   }

这是我要向其注入接口的服务

 public class DespatchTrackingDomainService : IDespatchTrackingDomainService
 {
    private readonly IKernel _kernel;
    private readonly IShippingCarrierRepository _shippingCarrierRepository;
    private readonly IDespatchLineRepository _despatchLineRepository;
    private readonly IOrderLineRepository _orderLineRepository;
    private readonly ICustomerRepository _customerRepository;
    private readonly IDespatchTrackingNotifications _despatchTrackingNotifications;
    private readonly ILog _log = LogManager.GetLogger(typeof(DespatchTrackingDomainService));

    public DespatchTrackingDomainService(
        IKernel kernel,
        IShippingCarrierRepository shippingCarrierRepository,
        IDespatchLineRepository despatchLineRepository,
        IOrderLineRepository orderLineRepository,
        ICustomerRepository customerRepository,
        IDespatchTrackingNotifications despatchTrackingNotifications)
    {
        _kernel = kernel;
        _shippingCarrierRepository = shippingCarrierRepository;
        _despatchLineRepository = despatchLineRepository;
        _orderLineRepository = orderLineRepository;
        _customerRepository = customerRepository;
        _despatchTrackingNotifications = despatchTrackingNotifications;
    }

我想了解为什么接口不能公开。

上面的代码将在我试图注入内部接口的服务类上引发错误。

错误是:

  

“可访问性不一致,与DespatchTrackingDomainService相比,参数类型DespatchTrackingNotifications的访问性更差。

0 个答案:

没有答案