如何在Bootstrapper文件中注册具有多个存储库类型的服务类?

我的一个服务层(ProductService)有4个参数化构造函数。 并且所有4个构造函数都注入了不同的存储库类型。

public class ProductService : IProductService { private IUserDal mUserDal { get; set; } private IItemDal mItemDal { get; set; } private IRoleDal mRoleDal { get; set; } private IBranchDal mBranchDal { get; set; } public ProductService (IUserDal userDal) { mUserDal = userDal; } public ProductService (IItemDal itemDal) { mItemDal = itemDal; } public ProductService (IRoleDal roleDal) { mRoleDal = roleDal; } public ProductService (IBranchDal branchDal) { mBranchDal = branchDal; } } 

ProductService层用于某些Controller类。

我正在将此ProductService类注册到Bootstrapper.cs(Unity DI)文件及其所有依赖项类型。但它没有正确注册。下面的一些示例如下: –

类型1:

  container.RegisterType<IUserDal, UserDal>(); container.RegisterType<IItemDal,ItemDal>(); container.RegisterType<IRoleDal,RoleDal>(); container.RegisterType<IBranchDal,BranchDal>(); container.RegisterType(); 

类型2:

  container.RegisterType(new InjectionConstructor(typeof(IUserDal), typeof(IItemDal), typeof(IRoleDal), typeof(IBranchDal))); 

但是上述类型都没有工作。任何人都知道如何在Bootstrapper文件中注册具有多个存储库类型的任何服务类?