Open haseebIC opened 3 years ago
I am having trouble with Postal setup. I have registered dependencies like below:
container.RegisterType<IEmailParser, EmailParser>(); container.RegisterType<IEmailViewRenderer, EmailViewRenderer>(); container.RegisterType<IEmailService, EmailService>();
On the controller side I have the following code:
private readonly IEmailService _emailService;
public EmailsController(IEmailService emailService) { this._emailService = emailService; }
public ActionResult Test() { var email = new TestEmail {
}; var message = _emailService.CreateMailMessage(email); return new EmailViewResult(email);
}
The dependencies are being injected properly by the unity container but the target view ("Test") is not being found by ViewEngine.
However, when I have the following code in the controller everything works fine.
private readonly IEmailService _emailService = new EmailService(ViewEngines.Engines);;
I believe I'm doing something wrong while registering the unity container. Please help me out.
Thanks
I am having trouble with Postal setup. I have registered dependencies like below:
container.RegisterType<IEmailParser, EmailParser>(); container.RegisterType<IEmailViewRenderer, EmailViewRenderer>(); container.RegisterType<IEmailService, EmailService>();
On the controller side I have the following code:
private readonly IEmailService _emailService;
public EmailsController(IEmailService emailService) { this._emailService = emailService; }
public ActionResult Test() { var email = new TestEmail {
}
The dependencies are being injected properly by the unity container but the target view ("Test") is not being found by ViewEngine.
However, when I have the following code in the controller everything works fine.
private readonly IEmailService _emailService = new EmailService(ViewEngines.Engines);;
public ActionResult Test() { var email = new TestEmail {
}
I believe I'm doing something wrong while registering the unity container. Please help me out.
Thanks