Using Nopcomerce 4.2
Take this example from the dependency injection of the Nop.Plugin.Tax.Avalara.Infrastructure plugin.
The OverriddenOrderProcessingService is injected as an IOrderProcessingService. But what if my plugin is using an overridden orderprocessing service as well.
I know I can give up an OrderId, but then we (I assume) completely lose the Tax.Avalara implementation of the order processing service.
Is there a way to use both implementations of the orderservice. Or do I need to override the Avalara OverriddenOrderProcessingService, that would break if the latter is not installed.
public virtual void Register(ContainerBuilder builder, ITypeFinder typeFinder, NopConfig config)
{
//register overridden services and factories
builder.RegisterType<OverriddenOrderProcessingService>().As<IOrderProcessingService>().InstancePerLifetimeScope();
builder.RegisterType<OverriddenOrderTotalCalculationService>().As<IOrderTotalCalculationService>().InstancePerLifetimeScope();
builder.RegisterType<OverriddenShoppingCartModelFactory>().As<Web.Factories.IShoppingCartModelFactory>().InstancePerLifetimeScope();
builder.RegisterType<OverriddenTaxModelFactory>().As<ITaxModelFactory>().InstancePerLifetimeScope();
//register custom services
builder.RegisterType<AvalaraTaxManager>().AsSelf().InstancePerLifetimeScope();
builder.RegisterType<TaxTransactionLogService>().AsSelf().InstancePerLifetimeScope();
//register custom data context
builder.RegisterPluginDataContext<TaxTransactionLogObjectContext>(AvalaraTaxDefaults.ObjectContextName);
builder.RegisterType<EfRepository<TaxTransactionLog>>().As<IRepository<TaxTransactionLog>>()
.WithParameter(ResolvedParameter.ForNamed<IDbContext>(AvalaraTaxDefaults.ObjectContextName))
.InstancePerLifetimeScope();
}