Is MVC 3 Scaffolding suitable for use in n-tier applications?

I have seen some examples of ASP.NET MVC3 Scaffolding, but these are always simple, basic applications. As for a multi-level solution with several projects:

/Data /Repository /Services /UI (MVC3) 

Major scaffolding pushes everything into the controller.

Is it possible to configure a forest template to execute POCOs from the Data project, then create a repository in the repository project, services in the Service project, and finally create a thin controller in MVC that knows nothing about the data context?

I'm a little confused because this is a real performance enhancer.

+4
source share
2 answers

If you use the -Repository flag, you get a repository. With the default templates that are in the Model folder (if areas are used, they fall into the corresponding Area Model folder).

You can customize the templates used by MvcScaffolding (see Steven Sanderson MVCConf2 video). However, in order to do something in separate projects, etc., it will be difficult if you have never used a powershell script.

Of course, there is nothing to stop moving files, renaming namespaces, etc. Yes, it takes a bit of work, but it is much better than nothing. I do this, I need only 10 minutes.

I expect someone to soon release the NuGet package of these kinds of things, or additional tools to simplify it.

As you say, this is a performance accelerator, but maybe you still need to work a little.

+2
source

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 configure this to know all the layers that you want, and, of course, you can link to other projects based on the repository, etc.

+1
source

Source: https://habr.com/ru/post/1369293/


All Articles