¿Se puede utilizar el andamio MVC 3 en aplicaciones de n capas?

I've seen some examples of ASP.NET MVC3 Scaffolding but those are always simple basic applications. What about layered/tiered solution with several Projects:

/Data  
/Repository  
/Services  
/UI (MVC3)  

The basic scaffolding pushes everything into the controller.

Can the scaffolding template be customized so it takes POCOs from Data project, then creates repository in a Repository project, services in a Service project and finally creates a thin controller in MVC that knows nothing about the data context?

I'm little confused because it's a real productivity booster.

preguntado el 27 de agosto de 11 a las 16:08

2 Respuestas

If you use the -Repository flag, you get a repository. With the default templates, that goes in the Model folder (if using areas, it goes in the corresponding Area Model folder).

You can customise the templates that MvcScaffolding uses (see Steven Sanderson MVCConf2 video). However, to get things to go into separate projects, etc, is going to be difficult, if you have never used powershell script.

There is of course, nothing to stop you moving the files, renaming the namespaces, etc. Yes it takes a bit of work, but it is a lot better than nothing. I do it, it takes me all of 10 minutes.

I would expect someone will produce a NuGet package of that sort of thing soon, or else extra tooling to make it easier.

As you say, it is a productivity booster, but maybe you still just gotta do a bit yourself.

Respondido 27 ago 11, 20:08

This is exactly what I wanted to hear. Thx. - nubm

Isnt that the same thing I mentioned below? Separate project support is indeed obtainable with mvcscaffolding. - Adam Tuliper - MSFT

Check out the Nuget mvcscaffolding project - good blog posts at http://blog.stevensanderson.com/2011/04/08/mvcscaffolding-scaffolding-custom-collections-of-files/

You can customize this to be aware of whatever layers you want and surely can reference other repository based projects etc.

Respondido 27 ago 11, 20:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.