是否有 aspnetboilerplate IIocResolver.ResolveAll 的替代品?
Is there a replacement for aspnetboilerplate IIocResolver.ResolveAll?
在abp.io中是否有类似的界面/功能?
我需要这样的东西:
public PaymentGatewayStore(IIocResolver iocResolver)
{
_iocResolver = iocResolver;
}
public List<PaymentGatewayModel> GetActiveGateways()
{
var gateways = _iocResolver.ResolveAll<IPaymentGatewayConfiguration>();
return gateways.Where(gateway => gateway.IsActive).Select(gateway => new PaymentGatewayModel
{
GatewayType = gateway.GatewayType,
SupportsRecurringPayments = gateway.SupportsRecurringPayments
}).ToList();
}
吉尔特·文斯特拉
您可以注入 IEnumerable<IYourService>
以注入一个接口的所有实现。或者,您可以使用 IServiceProvider.GetServices<IYourService>()
。
这是 AspNet Core 的标准依赖注入系统。参见 the documentation。
在abp.io中是否有类似的界面/功能?
我需要这样的东西:
public PaymentGatewayStore(IIocResolver iocResolver)
{
_iocResolver = iocResolver;
}
public List<PaymentGatewayModel> GetActiveGateways()
{
var gateways = _iocResolver.ResolveAll<IPaymentGatewayConfiguration>();
return gateways.Where(gateway => gateway.IsActive).Select(gateway => new PaymentGatewayModel
{
GatewayType = gateway.GatewayType,
SupportsRecurringPayments = gateway.SupportsRecurringPayments
}).ToList();
}
吉尔特·文斯特拉
您可以注入 IEnumerable<IYourService>
以注入一个接口的所有实现。或者,您可以使用 IServiceProvider.GetServices<IYourService>()
。
这是 AspNet Core 的标准依赖注入系统。参见 the documentation。