How to override service by plugin

How to override OrderService by plugin:

1. Create your custom new class derived from OrderService

If we prepare new class in this way:
public class MyOrderService : IOrderService 

We need to implement all methods from interface IOrderService  

If we prepare our new class based on OrderService, we can override only required public methods.

public class MyOrderService : OrderService, IOrderService

2. Override the DeleteOrder method

3. Create a new class, which will implement from IDependencyRegistrar. Set its "Order" property to higher value so it's run after the default one

public class DependencyRegistrar : IDependencyRegistrar

4. Register your new custom class as IOrderService.

back to top