5
Vote

Generate the both Service Class Repository Class

description

Basically I want both Service and Repository classes generated, and the service class has methods to use the methods in repository class. And the Controller uses the service class instead of repository class.

comments

RickHodder wrote Apr 27, 2011 at 7:26 PM

This functionality exists when scaffolding a controller by adding -Repository to the command:

scaffold controller Customer -Repository

paulmonks wrote May 10, 2011 at 5:36 AM

Rick i'm not sure that is what Ziang was asking for. I think he was looking for something like this http://www.asp.net/mvc/tutorials/validating-with-a-service-layer-cs

There are a couple of people that seem to have built there own templates, http://mvcscaffolding.codeplex.com/discussions/253575 and http://mvcscaffolding.codeplex.com/discussions/253692, though I think there is enough need/demand that adding it to the built-in scaffolds/templates is warranted (e.g. I want this too!). Plus it would be a great reference for people doing complex custom scaffold development.

I'm thinking something like a new scaffolder and template for "Service" and then an additional template for the Controller scaffolder called "ControllerWithServiceAndRepository".

ziangsong wrote May 13, 2011 at 4:41 AM

I finished the patch couple of weeks ago and it is being reviewed now.