Override ProductService problem

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 anni tempo fa
I've override the ProductService on my plugin. I only override the SearchProducts method. And for testing, I keep the code same as original. (I put same code with original code of method to my override method )
In the debug is succesfully working and hitting my override class clearly.
For example; I called Admin/Product/List action. This action contains SearchProducts method. And it is succesfully come to my plugin. It did same operations with original. No problem. And then I called /Admin/Product/Edit/9. It throw exception on the product.ProductTags property. Exception is ;
The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.

If i delete my overrides on the dependencyregistrar, code is working truely.
But if i list the product from my override method, it is working. But and then i try to go edit page , it is throwing exception.

What can i do for passing this?
6 anni tempo fa
Problem is solved.

My dependecy registrar was like this

            builder.RegisterType<MyOverrideProductService>().As<IProductService>()
.WithParameter(ResolvedParameter.ForNamed<ICacheManager>("nop_cache_static"))
.InstancePerLifetimeScope();


I remove WithParameter part, and prodlem did not occur again.

* working registrar
            builder.RegisterType<MyOverrideProductService>().As<IProductService>()
.InstancePerLifetimeScope();
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.