My Dependency Registrar looks like this:
namespace Nop.Plugin.Misc.MegaMetro.Infrastructure
{
public class DependencyRegistrar : IDependencyRegistrar
{
/// <summary>
/// Register services and interfaces
/// </summary>
/// <param name="builder">Container builder</param>
/// <param name="typeFinder">Type finder</param>
/// <param name="config">Config</param>
public virtual void Register(ContainerBuilder builder, ITypeFinder typeFinder, NopConfig config)
{
//installation localization service
builder.RegisterType<Web.Infrastructure.Installation.InstallationLocalizationService>().As<IInstallationLocalizationService>().InstancePerLifetimeScope();
//controllers (we cache some data between HTTP requests)
builder.RegisterType<MegaMetroController>()
.WithParameter(ResolvedParameter.ForNamed<ICacheManager>("nop_cache_static"));
//factories (we cache presentation models between HTTP requests)
builder.RegisterType<MegaProductModelFactory>().As<IMegaProductModelFactory>()
.WithParameter(ResolvedParameter.ForNamed<ICacheManager>("nop_cache_static"))
.InstancePerLifetimeScope();
}
/// <summary>
/// Order of this dependency registrar implementation
/// </summary>
public int Order
{
get { return 2; }
}
}
I get this error on trying to load the View.
Autofac.Core.DependencyResolutionException: Circular component dependency detected: MegaMetroController -> Nop.Plugin.Misc.MegaMetro.Factories.MegaProductModelFactory -> Nop.Plugin.Misc.MegaMetro.Factories.MegaProductModelFactory.