I was following a tutorial , but after setting the project build path, I run the project and navigate to plugins. Then I got the following error. An exception of type 'System.ArgumentNullException' occurred in Autofac.dll but was not handled in user code,
"Value cannot be null.\r\nParameter name: serviceType"
and i don't know that which method i should add and in which class?
Please help!
you must register the service you created in the plugin and also the repository for your entity in DependencyRegistrar.cs file so that run time Autofac can found them for example:
public class DependencyRegistrar : IDependencyRegistrar
{
public virtual void Register(ContainerBuilder builder, ITypeFinder typeFinder)
{
//data context
this.RegisterPluginDataContext<MYPLUGINObjectContext>(builder, "nop_object_context_misc_MYPLUGIN");
//override required repository with our custom context
builder.RegisterType<EfRepository<ENTITY>>()
.As<IRepository<ENTITY>>()
.WithParameter(ResolvedParameter.ForNamed<IDbContext>("nop_object_context_misc_MYPLUGIN"))
.InstancePerHttpRequest();
}
public int Order
{
get { return 0; }
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With