Data Services

Feb 21, 2015 at 9:03 PM
Edited Feb 21, 2015 at 9:07 PM
Hi! This is great work, thanks - I have learnt a huge amount from your efforts, but still have a few questions:

[1] It looks like the intention for each service in this pattern is to map to a single repository / entity. Where should I orchestrate my workflow across e.g. User and PaymentCard - in the controller, or in an additional façade? I initially thought that a "User" service might access both User and PaymentCard repositories.

[2] Why is _repository marked as private and not protected in the generic abstract service? Could be my misunderstanding of [1].

[3] Should "Entity" be refactored out into a separate project (e.g. Pattern.Model or something, away from Repository.Ef6) so that my web project doesn't need a reference to that library? (my controllers/view models are marshalling my entities which all inherit from Entity and so there is a reference from Web to Ef6 currently) This may be a requirement in any case though due to IQueryable?

Best regards
May 12, 2015 at 5:57 PM
  1. Incorrect, there is no implied 1 to 1, please inject as many repositories needed into your service to accomplish your use case.
  2. Not sure we have enough context here to answer this.
  3. Yes you can create a project Northwind.Entities which only has your POCOS and Northwind.Data which has all things EF, many teams take this approach for separation of concerns.
Marked as answer by lelong37 on 5/12/2015 at 9:57 AM