如何从另一个项目访问课程?

时间:2019-08-08 13:20:33

标签: asp.net-core dependency-injection

我在 Application 项目中有MailComposer.cs 和 Business 项目中的AccountBilling.cs。

我想在AccountBilling.cs内创建MailComposer的实例。

我在 Startup.cs

中添加了此内容
  services.AddTransient<IEmailSender, AuthMessageSender> ();
  services.AddScoped<IAccountBilling, AccountBilling> ();
  services.AddScoped<MailComposer> ();

AccountBilling.cs 内部,我尝试添加在构造函数内部构建MailComposer实例所需的类

public AccountBilling (EntityContext _context, IOptions<TBCPaymentOptions> tbcPaymentOptions, 
                                IOptions<PaymentOptions> _paymentDeadline, IOptions<DemoOptions> demoDaysCount,
                                IOptions<EmailConfiguration> _emailConfig,
                                IEmailSender _emailSender, IHostingEnvironment environment, 
                                IStringLocalizer<SharedResources> _SharedLocalizer) {}

错误是: 找不到类型或名称空间IEmailSender。 IStringLocalizer也是如此。

0 个答案:

没有答案