I am new to Rest services. I did fair bit of research on this topic but still not clearly understood. Hope someone clear this to me. Thanks in advance.
My client is going to execute a method on my service class through an url. All I understood is client going to call
localhost/service/get/customers
In my rest service I have dependencies like a IRepository
so that I can go to database and fetch the records. If I go with constructor injection when would client call this constructor?
It looks like I need to use a service locator to fetch IRepository
inside the method which I need it.
Doesn't this violate OOP principle? Is testing easy without DI?
Can anyone please clarify this.
For any service how do we expect client to know what is IRepository
is what methods it does have?
Is isn't it for internal implementation purpose Do we need t expose to the client? Why should he bother about it? Can't I provide just Uri Which method to call (localhost/service/Products) and job done.
I will appreciate if you provide any live example.
Thanks a lot.