C# Repository and Service

I have a Repository layer which implements some CRUD operations, and also a Service layer (which in some cases may have references to multiple repositories) for all of my entities.

Let's assume the following:

IRepository has void Add(EntityA entity);

IService has void SomeMoreComplexOperation(EntityA entity);

A have a couple of questions about what the best practice would be:

  • Should my IService also expose the IRepository methods (such as Add() )
  • Should my client (WebAPI Controller) get path an IService and IRepository injected? (this question kind of depends on the answer to #1)
  • 链接地址: http://www.djcxy.com/p/62578.html

    上一篇: 一个控制器在ASP.Net WebAPI中的多种方法

    下一篇: C#存储库和服务