New Service

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 Jahre weitere
Hello,
I created new entity in the core, and created also map, service....I am following procedure explained here
http://www.lateshtclick.com/blogpost/how-to-add-new-tables-to-nopcommerce

I have also external plugin (SevenSpike) and updated Nop.Framework too (dependency)

How can I use the new service in ProductService ? Is it possible ?

Thanks
Francesco
6 Jahre weitere
ftaglien wrote:
Hello,
I created new entity in the core, and created also map, service....I am following procedure explained here
http://www.lateshtclick.com/blogpost/how-to-add-new-tables-to-nopcommerce

I have also external plugin (SevenSpike) and updated Nop.Framework too (dependency)

How can I use the new service in ProductService ? Is it possible ?

Thanks
Francesco


Add your new service as a constructor parameter for the ProductService and register your service with Autofac.
6 Jahre weitere
Thanks seanrock,

I added in the ProductService constructor new service I created. What do you mean register with Autofac ?
I added it in the DependencyRegistrar in Nop.Framework, is it enough?

When I start application I receive error from SevenSpikes.Nop.Plugins.AnywhereSliders: is not able to find constructor for new service.

Francesco
6 Jahre weitere
ftaglien wrote:
Thanks seanrock,

I added in the ProductService constructor new service I created. What do you mean register with Autofac ?
I added it in the DependencyRegistrar in Nop.Framework, is it enough?

When I start application I receive error from SevenSpikes.Nop.Plugins.AnywhereSliders: is not able to find constructor for new service.

Francesco


Yes add to DependencyRegistrar (it uses Autofac ioc).

What dependencies does your new service have?
6 Jahre weitere
I have dependency on IRepository<MyEntity>
6 Jahre weitere
ftaglien wrote:
When I start application I receive error from SevenSpikes.Nop.Plugins.AnywhereSliders: is not able to find constructor for new service.

Francesco


This error is because some class (dependency) cannot be created. Maybe there is a problem with MyEntity or its map?
6 Jahre weitere
Maybe..I ll check, but why if I use IRepository<MyEntity> instead of service in ProductService constructor works fine? should I receive same error?
6 Jahre weitere
ftaglien wrote:
Maybe..I ll check, but why if I use IRepository<MyEntity> instead of service in ProductService constructor works fine? should I receive same error?


If the problem is with MyEntity AND MyEntity is a dependency for both, then yes, it would be reasonable to think you would receive the same or similar error.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.