3

Does anybody know of any examples of an MvcScaffolding T4 template for building Services/Repository pattern?

I know that MvcScaffolding comes with a Repository scaffold built in, but I'd like to have it also build a Services layer at the same time. I've spent an hour or so looking around but haven't seen what I'm looking for.

Suggestions? Thanks!

reidLinden
  • 4,020
  • 4
  • 31
  • 46

1 Answers1

1

The service layer is something specific to your domain, not your database. It is something that an automated tool cannot create because the service layer doesn't only depend on the database. It might depend on many other external factors. The service layer is something that you should build yourself and then you could reference the repositories that were created for you in this service layer.

But the main question you need to ask yourself is whether you need a service layer. Whether you have some complex business operations that are not simple CRUD operations with your data entities and which are handled directly by the repositories.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • Thanks for the reply, Darin. What I'm looking for is just the scaffolding, which, at the initial point of creation would essentially be just a pass through to the Repo Layer (unless I've got my head on backwards about this all)....eventually, when there is need, then we can modify the existing service wrapper to actually do something useful. The alternative is that my controller has to be re-written to call the service (to in turn call the repo) and deal with dependency injection etc... It just seems like it would be easier to build it with a scaffold in place already. – reidLinden Oct 26 '12 at 17:40