Я использую MVC AccountController, который реализует поставщик членства ASP.NET.
У меня есть репозиторий со всем доступом к моей базе данных, в который я добавил свойство стран, которое возвращает список стран. Я хочу добавить раскрывающийся список стран на страницу «Регистрация», чтобы иметь возможность получать эти данные из своего репозитория и передавать их в представление.
Я использовал внедрение в другие контроллеры, но я не знаю, как применить это к существующему AccountController.
// This constructor is used by the MVC framework to instantiate the controller using
// the default forms authentication and membership providers.
public AccountController()
: this(null, null)
{
}
// This constructor is not used by the MVC framework but is instead provided for ease
// of unit testing this type. See the comments at the end of this file for more
// information.
public AccountController(IFormsAuthentication formsAuth, IMembershipService service)
{
FormsAuth = formsAuth ?? new FormsAuthenticationService();
MembershipService = service ?? new AccountMembershipService();
}
Могу ли я изменить существующий конструктор AccountController для доступа к своему хранилищу?