以下のスニップには、3 つのインターフェイスを使用するコントローラーがあります。これらはNinject経由で配線されています。間違いなく正しい方向への一歩です。私の質問はこれですか?
1.) 3 つのインターフェイスを 1 つのインターフェイスにラップし、そのように実装して、コントローラーの ctor に渡されるパラメーターの量を減らす方がよいでしょうか? 2.) そのままにしておくと、機能していますか?
私は常に、あらゆるものから地獄を抽象化する方法を探しています。
public class RegistrationController : Controller
{
private readonly ICategoriesService _categoriesService;
private readonly IAuthenticationService _authenticationService;
private readonly IRegistrationService _registrationService;
// Ctor
public RegistrationController(ICategoriesService categoriesService,
IAuthenticationService authenticationService,
IRegistrationService registrationService)
{
_categoriesService = categoriesService;
_authenticationService = authenticationService;
_registrationService = registrationService;
}
}