Autofac An error occurred during the activation of a particular registration

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Autofac An error occurred during the activation of a particular registration



I have inherited a .NET project which keeps throwing Autofac errors but I'm not sure what this error message is telling me. Any help would be appreciated?


An error occurred during the activation of a particular registration. See the inner exception for details.
Registration:
Activator = ImplementationResourceRepository (ReflectionActivator),
Services = [Interfaces.IImplementationResourceRepository],
Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime,
Sharing = None,
Ownership = OwnedByLifetimeScope ---> None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'CCES.Repositories.ImplementationResourceRepository' can be invoked with the available services and parameters:
Cannot resolve parameter 'Interfaces.IRepository repository' of constructor 'Void .ctor(Interfaces.IRepository)'. (See inner exception for details.)





(side note) If any answers on your questions (I see you have asked questions in the past) do answer your question please take the time to mark them as "the answer" using the checkmark on the left side of the answer (just click it, it will turn green). This helps other identify the proper fix and those that took the time to help you also very much appreciate it. Thank you in advance.
– Igor
Aug 10 at 15:00





1 Answer
1



Type ImplementationResourceRepository has a constructor that takes an instance that implements Interfaces.IRepository in it's constructor but no types were registered as Interfaces.IRepository. You need to register a type that implementats Interfaces.IRepository as that interface with Autofac.


ImplementationResourceRepository


Interfaces.IRepository


Interfaces.IRepository


Interfaces.IRepository



Something similar to this:


protected override void Load(ContainerBuilder builder)

builder.RegisterType<Implementations.Repository>()
.As<Interfaces.IRepository>()
.InstancePerDependency();






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard