I've been studying design patterns. I've learned about Repositories, Unit Of Work, Dependency Injection, MVC. I'm now learning about Service Layer pattern.
I'm trying to grasp the utility purpose of Unit of Work(if any) in a Service Layer.
From my understanding services provide encapsulation for specific model database access as a main goal. So if I provide an IService to a Controller that controller will only be able to access the specifics provided in a service, whilst if I provide an IUnitOfWork it will have access to all the Repositories available in it.
I mean it seams logical that the IService accesses the Repositories directly since it will encapsulate the database access and provide business logic at the same time.
So in an IService what's the goal of the Unit of Work? Is it worth having one?